Пример #1
0
        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;
            }
        }
Пример #2
0
        public static bool DialogSaveLog()
        {
            bool saved = false;

            using (SaveFileDialog dialog = new SaveFileDialog())
            {
                dialog.Filter     = "XML|.xml";
                dialog.DefaultExt = ".xml";
                dialog.Title      = "Save Log File";

                if (dialog.ShowDialogAndOK())
                {
                    using (new WaitCursor())
                    {
                        Abnaki.Windows.AbnakiLog.Write(dialog.FileName);
                    }
                    saved = true;
                }
            }
            return(saved);
        }