示例#1
0
        private async void SaveFile_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.SaveFileDialog dialog = new Microsoft.Win32.SaveFileDialog();
            dialog.Filter           = "Файл конфигурации (*.mapc)|*.mapc";
            dialog.RestoreDirectory = true;
            bool?result = dialog.ShowDialog();

            progressBar.IsIndeterminate = true;
            progressBar.Visibility      = Visibility.Visible;
            statusBar.Text = "Выполняется сохранение файла...";
            await Task.Delay(100);

            if (result == true)
            {
                SerializationShield serializationShield = new SerializationShield();
                serializationShield.Write(dialog.FileName, myPanel);
                this.Title = "Map Creator - " + dialog.FileName;
            }

            progressBar.IsIndeterminate = false;
            progressBar.Visibility      = Visibility.Hidden;
            statusBar.Text = "Готово";
            MessageBox.Show("Файл конфигурации успешно сохранен!", "Сохранение", MessageBoxButton.OK);
            statusBar.Text = "";
        }
示例#2
0
        public MainWindow()
        {
            LoadConfig();
            string[] args = Environment.GetCommandLineArgs();

            if (args.Count() == 2)
            {
                if (!string.IsNullOrEmpty(args[1]) && File.Exists(args[1]))
                {
                    SerializationShield serializationShield = new SerializationShield();
                    serializationShield.Read(args[1], myPanel, UpdateForm_Click);
                    SortShield();
                    this.Title += " - " + args[1];
                }
            }
        }