void HandleMenu(ButtonMessage <SubMenuKey> m) { FileInfo fi; switch (m.Key) { case SubMenuKey.ReadUserPlacement: fi = LayoutFileInfo(); InvokeRestoringPanelLayout(fi); break; case SubMenuKey.ReadDefaultPlacement: ReadDefaultLayout(); break; case SubMenuKey.SaveUserPlacement: fi = LayoutFileInfo(); InvokeSavingPanelLayout(fi); break; case SubMenuKey.SaveAsPlacement: using (var dialog = new System.Windows.Forms.SaveFileDialog()) { dialog.SetFilters(Preference.FileExtWithoutDot); dialog.FileName = Preference.ClassPrefsFileOnly <MainWindow>(layoutFileQualifier); dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); if (dialog.ShowDialogAndOK()) { fi = new FileInfo(dialog.FileName); InvokeSavingPanelLayout(fi); } } break; } }
void ReadDefaultLayout() { FileInfo fi = AbnakiFile.CombinedFilePath(Preference.ApplicationDefaultDir(), Preference.ClassPrefsFileOnly <MainWindow>(layoutFileQualifier)); InvokeRestoringPanelLayout(fi); }