예제 #1
0
        private void SaveTypeEditorRowHeight()
        {
            var settings = new Settings(EditIoDeviceWindowTypeEditor);

            settings.SetDouble(RowHeight, typeEditorRow.ActualHeight);
            settings.Save();
        }
        public void ShowChooseDialog(bool closeOnEscape)
        {
            var dialog = new OpenFileDialog
            {
                Filter          = string.Format("{0} (*.{1})|*.{1}", Res.BackupFiles, NpgExImHelper.BackupFileExt),
                CheckFileExists = true,
                Multiselect     = false
            };
            var stringKeeper = new Settings("ProjectImEx");
            var lastFile     = stringKeeper.GetString("LastFile");

            if (!string.IsNullOrEmpty(lastFile) && File.Exists(lastFile))
            {
                dialog.InitialDirectory = Path.GetDirectoryName(lastFile);
                dialog.FileName         = lastFile;
            }
            if (dialog.ShowDialog(View as Window) == true)
            {
                stringKeeper.SetString("LastFile", dialog.FileName);
                stringKeeper.Save();
                FileName = dialog.FileName;
                if (string.IsNullOrEmpty(ConnectionParameters.Database))
                {
                    ConnectionParameters.Database = Path.GetFileNameWithoutExtension(FileName);
                }
            }
            else if (closeOnEscape)
            {
                View.DialogResult = false;
            }
        }
예제 #3
0
        public void Export()
        {
            var dialog = new SaveFileDialog
            {
                Filter          = string.Format("{0} (*.{1})|*.{1}", Res.BackupFiles, NpgExImHelper.BackupFileExt),
                CheckFileExists = false,
                OverwritePrompt = true
            };
            var stringKeeper = new Settings("ProjectImEx");
            var lastFile     = stringKeeper.GetString("LastFile");

            if (!string.IsNullOrEmpty(lastFile) && File.Exists(lastFile))
            {
                dialog.InitialDirectory = Path.GetDirectoryName(lastFile);
                dialog.FileName         = lastFile;
            }
            if (dialog.ShowDialog(View as Window) != true)
            {
                View.DialogResult = false;
                return;
            }
            stringKeeper.SetString("LastFile", dialog.FileName);
            stringKeeper.Save();
            var fileName = dialog.FileName;

            _service.ActionHelper.Async(() => Export(fileName));
        }
예제 #4
0
 public void ShowChooseDialog(bool closeOnEscape)
 {
     var dialog = new OpenFileDialog
         {
             Filter = string.Format("{0} (*.{1})|*.{1}", Res.BackupFiles, NpgExImHelper.BackupFileExt),
             CheckFileExists = true,
             Multiselect = false
         };
     var stringKeeper = new Settings("ProjectImEx");
     var lastFile = stringKeeper.GetString("LastFile");
     if (!string.IsNullOrEmpty(lastFile) && File.Exists(lastFile))
     {
         dialog.InitialDirectory = Path.GetDirectoryName(lastFile);
         dialog.FileName = lastFile;
     }
     if (dialog.ShowDialog(View as Window) == true)
     {
         stringKeeper.SetString("LastFile", dialog.FileName);
         stringKeeper.Save();
         FileName = dialog.FileName;
         if (string.IsNullOrEmpty(ConnectionParameters.Database))
         {
             ConnectionParameters.Database = Path.GetFileNameWithoutExtension(FileName);
         }
     }
     else if (closeOnEscape)
     {
         View.DialogResult = false;
     }
 }