Beispiel #1
0
        private bool SaveConfiguration(bool saveas)
        {
            MessageBoxResult messageBoxResult = MessageBox.Show("Сохранить настройки?", "Внимание", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning);

            switch (messageBoxResult)
            {
            case MessageBoxResult.Yes:
                if (File.Exists(AppSt.Default.cl_moncha_path) == false || saveas)
                {
                    SaveFileDialog saveFileDialog = new SaveFileDialog();
                    saveFileDialog.Filter = "Moncha File (*.mws)|*.mws";
                    if (saveFileDialog.ShowDialog() == true)
                    {
                        ProgressPanel.SetProgressBar(1, 2, "Save Moncha");
                        MonchaHub.Save(saveFileDialog.FileName);
                        if (File.Exists(saveFileDialog.FileName) == false)
                        {
                            ProgressPanel.SetProgressBar(2, 2, "Not Save");
                            SaveConfiguration(true);
                        }
                        else
                        {
                            ProgressPanel.SetProgressBar(2, 2, "Saved");
                            AppSt.Default.cl_moncha_path = saveFileDialog.FileName;
                        }
                    }
                }
                else
                {
                    MonchaHub.Save(AppSt.Default.cl_moncha_path);
                }
                MonchaPathBox.Content = AppSt.Default.cl_moncha_path;
                AppSt.Default.Save();
                ProgressPanel.End();
                return(false);

                break;

            case MessageBoxResult.No:
                ProgressPanel.End();
                return(false);

                break;

            case MessageBoxResult.Cancel:
                ProgressPanel.End();
                return(true);

                break;
            }
            ProgressPanel.SetProgressBar(2, 2, "Save Setting");

            ProgressPanel.End();
            return(false);
        }
Beispiel #2
0
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     MonchaHub.Save(AppSt.Default.cl_moncha_path);
     AppSt.Default.Save();
 }