void CancelHandler(EventToCommandArgs args)
 {
     //var parameter = args.CommandParameter;
     IsCanceled = true;
     CancelText = "Canceling...";
     IsCancelEnabled = false;
 }
 void ShowQuickStartHandler(EventToCommandArgs args)
 {
     //var parameter = args.CommandParameter;
     var quickStartFilename = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "ESME Workbench Quick Start.pdf");
     if (File.Exists(quickStartFilename)) System.Diagnostics.Process.Start(quickStartFilename);
     else if (MessageBoxService != null) MessageBoxService.ShowError("The Quick Start Guide was not found!");
 }
 void OkHandler(EventToCommandArgs args)
 {
     //var parameter = args.CommandParameter;
     if (!IsPSMView)
     {
         CloseDialog(true);
     }
     else
     {
         if (PropertyObject is Platform)
         {
             MediatorMessage.Send(MediatorMessage.PSMPlatformChanged, PropertyObject);
         }
         if (PropertyObject is Source)
         {
             MediatorMessage.Send(MediatorMessage.PSMSourceChanged, PropertyObject);
         }
     }
 }
 void RemoveSeriesBottomRightHandler(EventToCommandArgs args)
 {
     var lastSeries = ((GroupedBarSeriesViewModel)BottomRight.DataSeriesCollection.First()).BarSeriesCollection.Last();
     ((GroupedBarSeriesViewModel)BottomRight.DataSeriesCollection.First()).BarSeriesCollection.Remove(lastSeries);
 }
 void CancelHandler(EventToCommandArgs args)
 {
     //var parameter = args.CommandParameter;
     CloseDialog(false);
 }
 void SelectAllSpeciesHandler(EventToCommandArgs args) { foreach (var species in AvailableSpecies) species.IsSelected = true; }
 void SelectAllPlatformsHandler(EventToCommandArgs args) { foreach (var platform in AvailablePlatforms) platform.IsSelected = true; }
        void AnalyzeHandler(EventToCommandArgs args)
        {
            //PerformAnalysis();
#if true
            var analyzer = new SimulationLogAnalyzer
            {
                LogFilename = SelectedFileName, 
                BinCount = BinCount, 
                BinWidth = BinWidth, 
                FilterStartTime = _filterStartTime, 
                FilterEndTime = _filterEndTime,
                SelectedModeIds = (from mode in AvailableModes
                                   where mode.IsSelected
                                   select ((ModeNameGuid)mode.NameGuidRecord).ActorID).ToList(),
                SelectedSpeciesGuids = (from species in AvailableSpecies
                                        where species.IsSelected
                                        select species.NameGuidRecord.Guid).ToList(),
                StartBinValue = StartBinValue,
            };
            var remoteAnalysis = analyzer.Analyze(_dispatcher, _visualizer);
#endif
        }
 void OkHandler(EventToCommandArgs args)
 {
     if (_isGeoChanged) Platform.Geo = new Geo(Latitude, Longitude);
     if (!IsPSMView) CloseDialog(true);
     else MediatorMessage.Send(MediatorMessage.PSMPlatformChanged, Platform);
 }
 void ViewLoadedHandler(EventToCommandArgs args)
 {
     var routedEventArgs = (RoutedEventArgs)args.EventArgs;
     var source = routedEventArgs.Source;
     _view = (FourAxisSeriesView)source;
 }
 void SaveAsCSVHandler(EventToCommandArgs args)
 {
     _saveFileService.Filter = "Comma-Separated Value (*.csv)|*.csv";
     _saveFileService.OverwritePrompt = true;
     _saveFileService.FileName = "";
     var result = _saveFileService.ShowDialog();
     if (result.HasValue && result.Value)
     {
         using (var sw = new StreamWriter(_saveFileService.FileName)) sw.Write(ToCSV());
     }
 }
        void SaveAsImageHandler(EventToCommandArgs args)
        {
            _saveFileService.Filter = "Portable Network Graphics (*.png)|*.png|JPEG (*.jpg)|*.jpg|TIFF (*.tiff)|*.tiff|Bitmap (*.bmp)|*.bmp|GIF (*.gif)|*.gif";
            _saveFileService.OverwritePrompt = true;
            _saveFileService.FileName = "";

            var result = _saveFileService.ShowDialog();
            if (result.HasValue && result.Value)
            {
                Properties.Settings.Default.LastSaveDirectory = Path.GetDirectoryName(_saveFileService.FileName);
                _view.ToImageFile(_saveFileService.FileName);
            }
        }
 void CancelHandler(EventToCommandArgs args)
 {
     WebClient.CancelAsync();
     IsCanceled = true;
 }
 void TestHandler(EventToCommandArgs args)
 {
     if (Scenario != null) ESME.Globals.OpenFileService.InitialDirectory = Scenario.StorageDirectoryPath;
     ESME.Globals.OpenFileService.Filter = "PGRID files (*.pgrid)|*.pgrid|All files (*.*)|*.*";
     var result = ESME.Globals.OpenFileService.ShowDialog((Window)ESME.Globals.ViewAwareStatusService.View);
     if (result.HasValue && result.Value)
     {
         //((RAMGeoEngine)ESME.Globals.PluginManagerService[PluginType.TransmissionLossCalculator][PluginSubtype.RAMGeo].DefaultPlugin).ReadRamPGrid(_openFile.FileName);
     }
 }
 void MoveLayerToFront(EventToCommandArgs args)
 {
     MediatorMessage.Send(MediatorMessage.MoveLayerToFront, _worldMapLayer);
     MediatorMessage.Send(MediatorMessage.RefreshMap, true);
 }
 void ColorBarDoubleClickHandler(EventToCommandArgs args)
 {
     AnimationTime = TimeSpan.FromMilliseconds(200);
     AnimationTargetRange.ForceUpdate(ColorMapViewModel.Range == FullRange ? StatisticalRange : FullRange);
 }
 void MoveLayerBackward(EventToCommandArgs args)
 {
     MediatorMessage.Send(MediatorMessage.MoveLayerBackward, _worldMapLayer);
     MediatorMessage.Send(MediatorMessage.RefreshMap, true);
 }
 void ImportWaypointFileHandler(EventToCommandArgs args)
 {
     //var parameter = args.CommandParameter;
     Globals.OpenFileService.Title = "Import waypoint file";
     Globals.OpenFileService.Filter = "Waypoint files (*.wpt)|*.wpt|Text files (*.txt)|*.txt|All files (*.*)|*.*";
     var result = Globals.OpenFileService.ShowDialog(null);
     if (!result.HasValue || !result.Value) return;
     try
     {
         if (Platform.ShipTrack != null) Globals.MasterDatabaseService.Context.ShipTracks.Remove(Platform.ShipTrack);
         var shipTrack = ShipTrack.ReadWaypointFile(Globals.OpenFileService.FileName);
         Globals.MasterDatabaseService.Context.ShipTracks.Add(shipTrack);
         shipTrack.Platform = Platform;
         Platform.ShipTrack = shipTrack;
     }
     catch (Exception ex)
     {
         Globals.MessageBoxService.ShowError(ex.Message);
     }
 }
 static void CloseHandler(EventToCommandArgs args)
 {
     //var parameter = args.CommandParameter;
 }
 void KeyUpHandler(EventToCommandArgs args)
 {
     var parameter = (KeyEventArgs)args.EventArgs;
     switch (parameter.Key)
     {
         case Key.Delete:
             MediatorMessage.Send(MediatorMessage.DeletePlatform, this);
             break;
         case Key.Insert:
             MediatorMessage.Send(MediatorMessage.AddSource, this);
             break;
         default:
             return;
     }
 }
 void OkHandler(EventToCommandArgs args)
 {
     //var parameter = args.CommandParameter;
     Duration = TimeSpan.ParseExact(DurationString, TimeSpanFormatString, null);
     CloseDialog(true);
 }
 void CloseHandler(EventToCommandArgs args)
 {
     foreach (var window in OpenWindows) window.Close();
     Application.Current.Shutdown();
 }
 void MoveLayerBackward(EventToCommandArgs args)
 {
     foreach (var tl in Scenario.AnalysisPoints.SelectMany(ap => ap.TransmissionLosses)) tl.LayerSettings.MoveLayerBackward();
     MediatorMessage.Send(MediatorMessage.RefreshMap, true);
 }
 void SelectAllModesHandler(EventToCommandArgs args) { foreach (var mode in AvailableModes) mode.IsSelected = true; }
 void OkHandler(EventToCommandArgs args)
 {
     _editedMode.ModeName = ModeName;
     _editedMode.ModeType = ModeType;
     _editedMode.Depth = Depth;
     _editedMode.SourceLevel = SourceLevel;
     _editedMode.LowFrequency = LowFrequency;
     _editedMode.HighFrequency = HighFrequency;
     _editedMode.PulseInterval = TimeSpan.ParseExact(PulseIntervalString, TimeSpanFormatString, null);
     _editedMode.PulseLength = TimeSpan.ParseExact(PulseLengthString, TimeSpanFormatString, null);
     _editedMode.HorizontalBeamWidth = HorizontalBeamWidth;
     _editedMode.VerticalBeamWidth = VerticalBeamWidth;
     _editedMode.DepressionElevationAngle = DepressionElevationAngle;
     _editedMode.RelativeBeamAngle = RelativeBeamAngle;
     _editedMode.MaxPropagationRadius = MaxPropagationRadius;
     _editedMode.TransmissionLossPluginType = SelectedTransmissionLossEngine.PluginIdentifier.Type;
     _editedMode.SideLobeAttenuation = SideLobeAttenuation;
     _editedMode.RadialCount = RadialCountString == "Auto" ? 0 : int.Parse(RadialCountString);
     if (!_originalMode.IsAcousticallyEquivalentTo(_editedMode) || _originalMode.TransmissionLossPluginType != _editedMode.TransmissionLossPluginType) _editedMode.TransmissionLosses.ForEach(tl => tl.Modes.Remove(_editedMode));
     if (IsPSMView) MediatorMessage.Send(MediatorMessage.PSMModeChanged, _editedMode);
     else CloseActivePopUpCommand.Execute(true);
 }
 void OkHandler(EventToCommandArgs args)
 {
     CloseDialog(true);
 }
 void CancelHandler(EventToCommandArgs args)
 {
     //var parameter = args.CommandParameter;
     if (IsPSMView) { }
     else
     {
         CloseActivePopUpCommand.Execute(false);
     }
 }
 void MoveLayerToBack(EventToCommandArgs args)
 {
     foreach (var tl in TransmissionLosses) tl.LayerSettings.MoveLayerToBack();
     MediatorMessage.Send(MediatorMessage.RefreshMap, true);
 }
 void AddSeriesBottomRightHandler(EventToCommandArgs args)
 {
     const double rangeStart = 1;
     const int rangeEnd = 10;
     const double rangeStep = 1;
     var blackSeries = new BarSeriesViewModel
     {
         SeriesData = Range(rangeStart, rangeEnd, rangeStep).Select(x => Tuple.Create(x, x * 3.5)).ToObservableList(),
         ItemToPoint = i => new Point(((Tuple<double, double>)i).Item1, ((Tuple<double, double>)i).Item2),
         StrokeThickness = 1,
         SeriesName = "y = 3.5x",
         Fill = Brushes.Black,
     };
     ((GroupedBarSeriesViewModel)BottomRight.DataSeriesCollection.First()).BarSeriesCollection.Add(blackSeries);
 }