public void Open(params Object[] parameters) { Window window = DialogExtensions.Get <HelpWindow>(); if (window == null) { var kernel = _app.Get <IKernel>() as Kernel; var commands = _app.Get <ICommandFactory>(); var console = _app.Get <IConsole>(); var context = new DocumentationViewModel(kernel.Help, commands, console); window = WindowFactory.Instance.Create(context); } else { window.Activate(); } if (parameters.Length == 1 && parameters[0] is HelpSection) { var model = window.DataContext as DocumentationViewModel; if (model != null) { model.Topic = (HelpSection)parameters[0]; } } window.Show(); }
public void Open(params Object[] parameters) { var editor = DialogExtensions.Get <EditorWindow>() as Window; if (editor == null) { var kernel = _app.Get <Kernel>(); var console = _app.Get <IConsole>(); var service = _app.Get <IMathInputService>(); var context = new EditorViewModel(kernel, console, service); editor = WindowFactory.Instance.Create(context); } if (parameters.Length == 1 && parameters[0] is String) { var context = editor.DataContext as EditorViewModel; var file = (String)parameters[0]; if (!File.Exists(file)) { var directory = Path.GetDirectoryName(file); try { if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } File.Create(file).Close(); } catch { var message = String.Format(Messages.ErrorCannotCreateFile, file); var output = new OutputViewModel { Message = message, Title = Messages.UnexpectedError }; output.ShowWindow(); return; } } if (context != null) { context.OpenFile(file); } } editor.Show(); }
public void Open(params Object[] parameters) { Window current = DialogExtensions.Get <OptionsWindow>(); if (current == null) { var settings = _app.Get <ISettings>(); var dialogs = _app.Get <IDialogManager>(); var context = new OptionsViewModel(settings, dialogs); current = WindowFactory.Instance.Create(context); } current.Show(); }