예제 #1
0
 public ViewModel()
 {
     BunchSets = new BunchSets();
     BunchSets.OpenAllSets();
     BunchSets.CurrentSettingName = "Новый";
     SetsCount        = $"Всего: {BunchSets.GetCountSets()}";
     SettingSetsCount = $"Включено: 0";
 }
예제 #2
0
        // Диалог открытия сеттинга
        private void OpenSetting()
        {
            var openDialog = new Microsoft.Win32.OpenFileDialog();

            openDialog.DefaultExt = ".json";
            openDialog.Filter     = "Text files (*.json)|*.json";

            Nullable <bool> result = openDialog.ShowDialog();

            if (result == true)
            {
                AllToCommon.Execute(null);
                string fileName = openDialog.FileName;
                BunchSets.DeserializeSetting(fileName);
            }
            UpdateSettingSetsCount();
        }
예제 #3
0
        // Диалог сохранения сеттинга
        private void SaveSetting()
        {
            var saveDialog = new Microsoft.Win32.SaveFileDialog();

            if (BunchSets.CurrentSettingName != "Новый")
            {
                saveDialog.FileName = BunchSets.CurrentSettingName;
            }
            saveDialog.DefaultExt = ".json";
            saveDialog.Filter     = "Text files (*.json)|*.json";

            Nullable <bool> result = saveDialog.ShowDialog();

            if (result == true)
            {
                string fileName = saveDialog.FileName;
                BunchSets.SerializeCurrentSetting(fileName);
            }
        }