Esempio n. 1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            var dialog = new FileChooserDialog(
                "Save configuration",
                this,
                FileChooserAction.Save);

            dialog.AddButton(Stock.Cancel, ResponseType.Cancel);
            dialog.AddButton(Stock.Save, ResponseType.Ok);
            dialog.SetCurrentFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
            dialog.SelectMultiple = false;

            var response = (ResponseType)dialog.Run();

            if (response == ResponseType.Ok)
            {
                if (_sikInterface.SaveParamsToFile(dialog.Filename))
                {
                    StatusMessage = "Parameters saved to a backup file.";
                }
                else
                {
                    StatusMessage = "Failed to save the parameters file.";
                }
            }
            dialog.Dispose();
        }
Esempio n. 2
0
        private void Button_SaveClick(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "JSON file (*.json)|*.json";
            saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            if (saveFileDialog.ShowDialog() == true)
            {
                if (_sikInterface.SaveParamsToFile(saveFileDialog.FileName))
                {
                    StatusMessage = "Parameters saved to a backup file.";
                }
                else
                {
                    StatusMessage = "Failed to save the parameters file.";
                }
            }
        }