Beispiel #1
0
        private async Task PlotViewModel_ClosedAsync(object sender, ViewModelClosedEventArgs e)
        {
            PlotViewModel pvm = e.ViewModel as PlotViewModel;

            if (pvm == null)
            {
                return;
            }
            Plots.Remove(pvm.PlotModel);
        }
Beispiel #2
0
 /// <summary>
 /// Method to invoke when the NewPlotCommand command is executed.
 /// </summary>
 private async Task OnNewPlotCommandExecuteAsync()
 {
     try
     {
         var plotmodel = new Models.PlotModel();
         Plots.Add(plotmodel);
         var viewModel = new PlotViewModel(plotmodel);
         viewModel.ClosedAsync += PlotViewModel_ClosedAsync;
         ServiceLocator.Default.ResolveType <IUIVisualizerService>().Show(viewModel);
     }
     catch (Exception ex)
     {
         string errmsg = string.Format("Error creating new plot: {0}", ex.Message);
         LogTo.Error(errmsg);
         await Shared.Utility.ShowErrorMsgAsync(this, errmsg);
     }
 }
Beispiel #3
0
 private void OpenConfiguration(string path)
 {
     using (var fileStream = File.Open(path, FileMode.Open))
     {
         var configuration = new SerializationConfiguration
         {
             Culture = new System.Globalization.CultureInfo("en-US")
         };
         WindowModel = MainWindowModel.Load(fileStream, SerializationMode.Xml, configuration);
     }
     //open the plots
     foreach (PlotModel pm in Plots)
     {
         var viewModel = new PlotViewModel(pm);
         viewModel.ClosedAsync += PlotViewModel_ClosedAsync;
         ServiceLocator.Default.ResolveType <IUIVisualizerService>().Show(viewModel);
     }
     SaveConfigPath = path;
     this.ClearIsDirtyOnAllChilds();
     this.IsDirty = false;
     ViewModelCommandManager.InvalidateCommands(true);
     LogTo.Info("Loaded Plot configuration from: {0}", SaveConfigPath);
 }