private void TemplateOpen() { TemplateCloseCommand.ExecuteIfCan(); if (TemplateNodeItemRoot != null) { return; } TemplateOpen(ProjectItemTemplatesLocation + @"\KalView.zip"); return; var ofd = new OpenFileDialog(); ofd.Filter = "zip files|*.zip"; if (ofd.ShowDialog() == true) { TemplateOpen(ofd.FileName); } }
private void TemplateCreate() { if (TemplateNodeItemRoot?.IsModifed == true) { var result = MessageBox.Show($"Save template '{TemplateNodeItemRoot.Name}' changes?", "Save template", MessageBoxButton.YesNoCancel); if (result == MessageBoxResult.Cancel) { return; } else if (result == MessageBoxResult.Yes) { TemplateSaveCommand.ExecuteIfCan(); } TemplateCloseCommand.ExecuteIfCan(); } var sfd = new SaveFileDialog(); sfd.Filter = "Zip files (*.zip)|*.zip"; if (sfd.ShowDialog() != true) { return; } try { File.WriteAllBytes(sfd.FileName, Properties.Resources.template); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } TemplateOpen(sfd.FileName); }