Ejemplo n.º 1
0
 void ShowErrorLoadDictionary(KryptonTaskDialog dialog, string dir)
 {
     if (!dialog.CheckboxState)
     {
         dialog.Content = string.Format(Strings.DictNotFound, dir);
         dialog.ShowDialog();
     }
 }
Ejemplo n.º 2
0
        public static DialogResult ShowKryptonMessageBox(string title, string mainIntrustion, string content, TaskDialogButtons commonButton, MessageBoxIcon icon, IWin32Window owner = null)
        {
            KryptonTaskDialog kUserDialog = new KryptonTaskDialog();

            kUserDialog.WindowTitle     = title;
            kUserDialog.MainInstruction = mainIntrustion;
            kUserDialog.Content         = content;
            kUserDialog.CommonButtons   = commonButton;
            kUserDialog.Icon            = icon;
            return(kUserDialog.ShowDialog(owner));
        }
Ejemplo n.º 3
0
 private void MenuItemRestoreClick(object sender, EventArgs e)
 {
     if (!this.database.IsEmpty)
     {
         KryptonTaskDialog dlg = new KryptonTaskDialog();
         dlg.WindowTitle = Strings.Import;
         dlg.MainInstruction = Strings.ImportData;
         dlg.Content = Strings.DataClear;
         dlg.Icon = MessageBoxIcon.Question;
         dlg.CommonButtons = TaskDialogButtons.OK | TaskDialogButtons.Cancel;
         dlg.RadioButtons.AddRange(new KryptonTaskDialogCommand[] {
                                       this.commandClearData,
                                       this.commandCreateNew
                                   });
         if (dlg.ShowDialog() == DialogResult.Cancel)
         {
             return;
         }
         
         if (dlg.DefaultRadioButton == this.commandClearData)
         {
             this.database.Recreate();
         }
         else
         {
             if (!this.CreateDatabase())
             {
                 return;
             }
         }
     }
     
     if (this.restoreBackupDialog.ShowDialog() == DialogResult.OK)
     {
         XmlDocument doc = new XmlDocument();
         doc.Load(this.restoreBackupDialog.FileName);
         
         ImportExecutorClass ic = new ImportExecutorClass(this.database, doc, "/database/configuration");
         ic.ExecuteImport();
         
         this.ImportFolders(doc);
         this.ImportFilters(doc);
         
         ImportExecutorData ide = new ImportExecutorData(this.database, doc, "/database/records/record");
         ide.ExecuteImport();
         
         this.formGroupList.UpdateCategories();
         //this.Folders.UpdateCategories();
         this.formConfig.CreateCategoriesList();
         //this.Configuration.CreateCategoriesList();
     }
 }
Ejemplo n.º 4
0
        private string CheckFileExists(string filename)
        {
            if (File.Exists(filename))
            {
                return(filename);
            }

            if (_textData.IsOpened && Path.GetFileName(_textData.Filename) == Path.GetFileName(filename))
            {
                return(filename);
            }

            string baseDir = Utilities.GetAbsolutePath(Properties.Settings.Default.ScriptPath);

            var files = Directory.GetFiles(baseDir, Path.GetFileName(filename), SearchOption.AllDirectories);

            if (files.Length == 0)
            {
                return(null);
            }

            var ktd = new KryptonTaskDialog
            {
                Icon            = MessageBoxIcon.Information,
                CommonButtons   = TaskDialogButtons.Cancel,
                WindowTitle     = "看上去这个存档中记录的路径信息不太正确",
                MainInstruction = "不过,下面这个文件可能是正确的 :",
                Content         = Utilities.GetRelativePath(files[0], Utilities.GetAbsolutePath("")),
            };

            var ktdcOk = new KryptonTaskDialogCommand
            {
                DialogResult = DialogResult.OK,
                Image        = Properties.Resources.arrow_right_green,
                Text         = "好,就用这个",
            };
            var ktdcNo = new KryptonTaskDialogCommand
            {
                DialogResult = DialogResult.Cancel,
                Image        = Properties.Resources.arrow_right_red,
                Text         = "不,这个是错误的",
            };

            ktd.CommandButtons.AddRange(new[] { ktdcOk, ktdcNo });
            if (ktd.ShowDialog() == DialogResult.OK)
            {
                return(files[0]);
            }

            return(null);
        }
Ejemplo n.º 5
0
 bool Confirm(string pKey, string pMsg)
 {
     if (((ToolStripMenuItem)this.ToolStripMenuItemOption.DropDownItems[pKey]).Checked)
     {
         KryptonTaskDialog dialog = new KryptonTaskDialog
         {
             CheckboxText    = @"以后不再确认",
             CheckboxState   = false,
             WindowTitle     = @"确认",
             MainInstruction = string.Format("{0}\t", pMsg),                    //不加\t中文显示缺最后一个字
             Icon            = MessageBoxIcon.Question,
             CommonButtons   = TaskDialogButtons.OK | TaskDialogButtons.Cancel
         };
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             ((ToolStripMenuItem)this.ToolStripMenuItemOption.DropDownItems[pKey]).Checked = dialog.CheckboxState == false;
             return(true);
         }
         return(false);
     }
     return(true);
 }
Ejemplo n.º 6
0
        public bool ShowConfigure()
        {
            this.LoadParameters();
            lang = MainForm.Config.App.View.LocalName;
            if (ShowDialog() == DialogResult.OK)
            {
                this.SaveParameters();
                if ((lang != MainForm.Config.App.View.LocalName) && MainForm.Config.App.View.WarningChangeLanguage)
                {
                    KryptonTaskDialog d = new KryptonTaskDialog();
                    d.WindowTitle   = Strings.LangChangedTitle;
                    d.Content       = Strings.LangChangedContent;
                    d.CheckboxText  = Strings.LangChangedCheck;
                    d.CheckboxState = false;
                    d.ShowDialog();
                    MainForm.Config.App.View.WarningChangeLanguage = !d.CheckboxState;
                }

                return(true);
            }

            return(false);
        }