/// <summary> /// Opens a dialog to open a format file /// </summary> private void OpenFormat() { UpdateTextBox.Invoke(); if (!Format.OverwriteConfirmation()) { return; } OpenFileDialog ofd = new OpenFileDialog { Title = "Open format file", Filter = "JSON Files (*.json)|*.json" }; if (ofd.ShowDialog() != true) { return; } VM_HeaderNode newFormat = new VM_HeaderNode(this, ofd.FileName); if (newFormat.FormatFilePath != ofd.FileName) { return; } Format = newFormat; ResetMessage(); }
/// <summary> /// Creates a new format file /// </summary> private void NewFormat() { UpdateTextBox.Invoke(); if (!Format.OverwriteConfirmation()) { return; } Format = new VM_HeaderNode(this); ResetMessage(); }
/// <summary> /// Sets up the viewmodel /// </summary> /// <param name="settings">The settings viewmodel, which was created before in order to load the correct settings</param> public VM_Main() { Settings = new VM_Settings(this); MessageColor = new SolidColorBrush(Colors.Transparent); if (string.IsNullOrWhiteSpace(Properties.Settings.Default.DefaultFormatPath)) { Format = new VM_HeaderNode(this); } else { Format = new VM_HeaderNode(this, Properties.Settings.Default.DefaultFormatPath); } }