flier268

@flier268

Joined on May 3, 2021

  • 特徵: await this.router.navigate(['/main']); 以及authGuard失效 export const routes: Routes = [ { path: 'login', loadComponent: () => import('@features/login/login.component').then(m => m.LoginComponent), }, {
     Like  Bookmark
  • 這次遇到的問題是,要如何讓使用者安裝nuget套件後,會在程式輸出目錄看到dll,看到很多相關的討論 平台是.NET 8 修改.csproject中的 <ItemGroup> <None Update="A.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None>
     Like  Bookmark
  • 兩個方法 從系統移除WebDAV,在安裝IIS的那邊 缺點:無法用Visual Studio直接發布到IIS 修改Web.config<system.webServer> <modules runAllManagedModulesForAllRequests="false"> <remove name="WebDAVModule"/> </modules> <handlers> <remove name="WebDAV" />
     Like  Bookmark
  • 有時候難免會手殘,不小心使用錯的使用者名稱簽入,這時候怎麼辦呢? 最後我找到了答案 大概是這樣: 先變更使用者名稱跟信箱,避免之後還是錯 git config --local user.name "FirstName LastName" git config --local user.email first.last@example.com 修改最後的6次提交(次數自己改)
     Like  Bookmark
  • <a mat-menu-item [matMenuTriggerFor]="animals" #trigger="matMenuTrigger" (mouseenter)="trigger.openMenu()" (mouseleave)="trigger.closeMenu()" >Link 1</a> <mat-menu #animals="matMenu" xPosition="after" [hasBackdrop]="false">aaa</mat-menu>
     Like  Bookmark
  • 狀況 今天遇到一個問題,當我在使用這段程式碼時 private static HttpClient LoginWithJwtToken(string token) { Client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); return Client; } var client = LoginWithJwtToken(token);
     Like  Bookmark
  • 假設要把git-tfs加入專案的LibraryRepo資料夾中,名為git-tfs的目錄下 git subtree add --prefix LibraryRepo/git-tfs https://github.com/git-tfs/git-tfs.git master
     Like  Bookmark
  • 在app.config加入: <system.webServer> <modules> <remove name="WebDAVModule" /> </modules> <handlers> <remove name="WebDAV" /> </handlers> </system.webServer>
     Like  Bookmark
  • 移除Local的tag git tag -d v1.2.0 移除遠端tag git push --delete origin v1.2.0
     Like  Bookmark
  • 取得git-tfs 兩種方法從Github下載 透過choco choco install gittfs -y 把Collection下的Project(DIGI)轉成Git git-tfs clone http://vms022:8080/tfs/TERS $/DIGI
     Like  Bookmark
  • <img src="images/test.txt" alt="This is title" onerror="this.style.display='none';">
     Like  Bookmark
  • 今天遇到一個問題,將ItemsControl的ItemSource綁定到ObservableCollection<T>後,不知道為什麼,總是會在最後面多出一個空白的項目,ViewModel明明就找不到那項,但詭異的就是會自己生出那項 <ItemsControl ItemsSource="{Binding Pictures}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Rows="{Binding RowsCount}" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate>
     Like  Bookmark
  • 如果希望視窗內容會依照視窗大小縮放,通常會採用ViewBox,但如果今天只有水平要伸縮,垂直要出現ScrollBar呢? 首先,要先知道一個寫WPF時,微軟沒有明講的事情(至少我以前不知道),就是元件在沒有手動設定高度的時候,預設都是無限(double.PositiveInfinity),但螢幕不是無限大的阿,設為無限又是怎麼變成我們看到的高度呢? 因為元件的高度雖然是無限,但實際上在繪製之前,就會呼叫一個叫做MeasureOverride的函數,他會計算元件真正的高度,最後才被繪製出來,有時候看到有人在自訂元件的時候,也會透過複寫(override)這個函數,達到調整元件高度的目的。 然後還要說到ScrollViewer,這個元件跟其他元件一樣,預設高度也是無限(這邊指的是元件本身),他計算高度的時候會從他的外層去抓(在以下範例中就是Grid),但可以看到Row1的高度是Auto,Auto其實就是無限,但是Grid的Auto不太一樣的是,他會用內容的高度計算高度,於是呼,最終會往回找到ViewBox裡面內容的高度,所以Grid、Row1、ScrollViewer會變得跟Button延伸後一樣高,ScrollViewer都長高了,ScrollBar當然也就不會出現了。 整理步驟為:
     Like  Bookmark
  • 一般都會以為Frame的DataContext設定了以後,就會自動套用到Page,但其實就算設定了也不會生效 ㄟ,flier268,既然沒有用那幹嘛設定? 這時候可以用個小技巧,讓Frame載入後(Loaded事件),將Frame中的Page的DataContext設的跟Frame的DataContext一樣,這樣就OK了,如果有更好的方法請指點一下 Demo code MainWindow.xaml <Window ...> <Frame DataContext="{Binding ResultTablePageViewModel}" Loaded="OnLoaded" Source="ResultTablePage.xaml" /> </Window>
     Like  Bookmark
  • 字訂元件是WPF一項很重要的技術,我從自訂深度幫他定義了多個Level,深度越深可以自訂的東西越多,如果想要很炫麗的元件,除了用別人做好的套件以外,只能自己學習如何深度自訂元件。 最簡單的字訂元件,就是在Resource寫Style,然後在元件上透過指定Style套用 一般設定元件樣式的時候,會這樣寫 <TextBlock Text="Custom TextBlock 1" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="100" Margin="5" Padding="3"/> <TextBlock Text="Custom TextBlock 2" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="100" Margin="8" Padding="3" Foreground="Red"/> 這樣做的問題就是,如果如果有很多相同的屬性要自訂,將會重複寫很多的程式碼,軟體工程師的共同特色就是懶,我們就是不想寫一堆一樣的東西,所以程式碼的再利用就顯得無比重要,這時候就來到今天的主題,Style in resource
     Like  Bookmark
  • 上一章自訂元件 Level 1: Style in resource講了如何使用Style與ResourceDictionary重複使用樣式,因為這一章會省略前面講過的內容,所以如果還不會的同學請先去看一下喔~ 這一章要講如何使用Trigger讓元件動起來,像是滑鼠滑過去文字變紫色之類的效果。 Trigger <Style TargetType="TextBlock"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Foreground" Value="Purple" /> </Trigger>
     Like  Bookmark
  • // C:\\Folder\\aaa.exe System.Reflection.Assembly.GetExecutingAssembly().Location; Process.GetCurrentProcess().MainModule.FileName; // C:\\Folder Directory.GetParent(Assembly.GetExecutingAssembly().Location) // C:\\Folder System.AppDomain.CurrentDomain.BaseDirectory
     Like  Bookmark