/// <summary> /// Adds the RFDeviceViewModel. /// </summary> /// <param name="dvm">The DVM.</param> /// <param name="bIsSelected">if set to <c>true</c> [b is selected].</param> private void AddRFDevice(RFDeviceViewModel dvm, bool bIsSelected = false) { dvm.OnSelectionChanged += DeviceViewModel_OnSelectionChanged; this.RFDeviceViewModelCollection.Add(dvm); this.mcMapControl.Markers.Add(dvm.Marker); if (bIsSelected == true) { this.bNoFlashBack = true; this.dgRFDevices.SelectedItems.Clear(); this.dgRFDevices.SelectedItems.Add(dvm); this.dgRFDevices.ScrollIntoView(dvm); dvm.IsSelected = true; foreach (RFDeviceViewModel model in this.RFDeviceViewModelCollection) { if (model != dvm) { model.IsSelected = false; } } this.bNoFlashBack = false; } }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="QRCodeDialog" /> class. /// </summary> /// <param name="rfdefvice">The rfdefvice.</param> public QRCodeDialog(RFDeviceViewModel rfdefvice) { InitializeComponent(); this.RFDevice = rfdefvice; this.DataContext = rfdefvice; CreateQRCode(); }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="RFDeviceEditDialog"/> class. /// </summary> public RFDeviceEditDialog(Models.RFDevice device) { InitializeComponent(); // Use An Copy If The User Discard The Changes ... this.Device = new RFDeviceViewModel(null, device.Clone()); this.dgcbcRxTxType.ItemsSource = RxTxTypes.Values; this.DataContext = this; }
/// <summary> /// Deletes from templates. /// </summary> /// <param name="dvm">The DVM.</param> private void DeleteFromTemplates(RFDeviceViewModel dvm = null) { if (this.CurrentSelectedTemplate == EMPTY_TEMPLATE) { MB.Warning("You Can't Not Delete The Default Template!"); return; } this.RFDeviceTemplateCollection.Remove(this.CurrentSelectedTemplate); this.CurrentSelectedTemplate = EMPTY_TEMPLATE; }
/// <summary> /// Opens the device edit dialog. /// </summary> //private void OpenDeviceEditDialog(RFDevice device) private void OpenDeviceEditDialog(RFDeviceViewModel device) { RFDeviceEditDialog ded = new RFDeviceEditDialog(device); if (ded.ShowDialog() ?? false == true) { DeleteRFDevice(device); AddRFDevice(ded.Device); } ded = null; }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Opens the rf device in google maps. /// </summary> /// <param name="rfdefvice">The rfdefvice.</param> private void OpenInGoogleMaps(RFDeviceViewModel rfdefvice) { if (rfdefvice == null) { throw new ArgumentNullException(nameof(rfdefvice)); } //string strUrl = string.Format(new NumberFormatInfo { NumberDecimalSeparator = "." }, "https://www.google.de/maps/@{0},{1},500m/sensorset=!3m1!1e3", rfdefvice.Latitude, rfdefvice.Longitude); //string strUrl = string.Format( new NumberFormatInfo { NumberDecimalSeparator = "." } , "https://www.google.de/maps/@{0},{1},100m" , rfdefvice.Latitude , rfdefvice.Longitude ); string strUrl = string.Format(new NumberFormatInfo { NumberDecimalSeparator = "." }, "https://www.google.de/maps/place/{0},{1}", rfdefvice.Latitude, rfdefvice.Longitude); Tools.Windows.OpenWebAdress(strUrl); }
/// <summary> /// Adds to templates. /// </summary> /// <param name="dvm">The DVM.</param> private void AddToTemplates(RFDeviceViewModel dvm) { AddToTemplates(dvm.RFDevice); }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Deletes the RFDevice. /// </summary> /// <param name="dvm">The DVM.</param> private void DeleteRFDevice(RFDeviceViewModel dvm) { dvm.OnSelectionChanged -= DeviceViewModel_OnSelectionChanged; this.RFDeviceViewModelCollection.Remove(dvm); this.mcMapControl.Markers.Remove(dvm.Marker); }