public override object Clone() { LinearGaugeElement element = (LinearGaugeElement)base.Clone(); element.Subject = (Subject)Subject.Clone(); return(element); }
internal void RemoveLinearGauge() { Screen screen = SelectedTreeItem.Parent.Parent.Tag as Screen; LinearGaugeElement linearGauge = (LinearGaugeElement)SelectedListItem.Tag; if (screen != null) { screen.PanelElements.Remove(linearGauge); } else { PanelElements.Remove(linearGauge); } ListItems.Remove(SelectedListItem); SelectedListItem = null; }
internal void CopyLinearGauge() { Screen screen = SelectedTreeItem.Parent.Parent.Tag as Screen; LinearGaugeElement linearGauge = (LinearGaugeElement)((LinearGaugeElement)SelectedListItem.Tag).Clone(); if (screen != null) { screen.PanelElements.Add(linearGauge); } else { PanelElements.Add(linearGauge); } ListViewItemModel newItem = new ListViewItemModel { Texts = new ObservableCollection <string>(new string[10]), Tag = linearGauge }; UpdateListItem(newItem); ListItems.Add(newItem); SelectedListItem = ListItems.Last(); }
internal void UpdateListItem(ListViewItemModel item) { Screen screen = item.Tag as Screen; PilotLampElement pilotLamp = item.Tag as PilotLampElement; NeedleElement needle = item.Tag as NeedleElement; DigitalNumberElement digitalNumber = item.Tag as DigitalNumberElement; DigitalGaugeElement digitalGauge = item.Tag as DigitalGaugeElement; LinearGaugeElement linearGauge = item.Tag as LinearGaugeElement; TimetableElement timetable = item.Tag as TimetableElement; TouchElement touch = item.Tag as TouchElement; if (screen != null) { item.Texts[0] = screen.Number.ToString(culture); item.Texts[1] = screen.Layer.ToString(culture); } if (pilotLamp != null) { item.Texts[0] = pilotLamp.Subject.ToString(); item.Texts[1] = $"{pilotLamp.LocationX.ToString(culture)}, {pilotLamp.LocationY.ToString(culture)}"; item.Texts[2] = pilotLamp.DaytimeImage; item.Texts[3] = pilotLamp.NighttimeImage; item.Texts[4] = pilotLamp.TransparentColor.ToString(); item.Texts[5] = pilotLamp.Layer.ToString(culture); } if (needle != null) { item.Texts[0] = needle.Subject.ToString(); item.Texts[1] = $"{needle.LocationX.ToString(culture)}, {needle.LocationY.ToString(culture)}"; item.Texts[2] = needle.DefinedRadius ? needle.Radius.ToString(culture) : string.Empty; item.Texts[3] = needle.DaytimeImage; item.Texts[4] = needle.NighttimeImage; item.Texts[5] = needle.Color.ToString(); item.Texts[6] = needle.TransparentColor.ToString(); item.Texts[7] = needle.DefinedOrigin ? $"{needle.OriginX.ToString(culture)}, {needle.OriginY.ToString(culture)}" : string.Empty; item.Texts[8] = needle.InitialAngle.ToDegrees().ToString(culture); item.Texts[9] = needle.LastAngle.ToDegrees().ToString(culture); item.Texts[10] = needle.Minimum.ToString(culture); item.Texts[11] = needle.Maximum.ToString(culture); item.Texts[12] = needle.DefinedNaturalFreq ? needle.NaturalFreq.ToString(culture) : string.Empty; item.Texts[13] = needle.DefinedDampingRatio ? needle.DampingRatio.ToString(culture) : string.Empty; item.Texts[14] = needle.Backstop.ToString(); item.Texts[15] = needle.Smoothed.ToString(); item.Texts[16] = needle.Layer.ToString(culture); } if (digitalNumber != null) { item.Texts[0] = digitalNumber.Subject.ToString(); item.Texts[1] = $"{digitalNumber.LocationX.ToString(culture)}, {digitalNumber.LocationY.ToString(culture)}"; item.Texts[2] = digitalNumber.DaytimeImage; item.Texts[3] = digitalNumber.NighttimeImage; item.Texts[4] = digitalNumber.TransparentColor.ToString(); item.Texts[5] = digitalNumber.Interval.ToString(culture); item.Texts[6] = digitalNumber.Layer.ToString(culture); } if (digitalGauge != null) { item.Texts[0] = digitalGauge.Subject.ToString(); item.Texts[1] = $"{digitalGauge.LocationX.ToString(culture)}, {digitalGauge.LocationY.ToString(culture)}"; item.Texts[2] = digitalGauge.Radius.ToString(culture); item.Texts[3] = digitalGauge.Color.ToString(); item.Texts[4] = digitalGauge.InitialAngle.ToDegrees().ToString(culture); item.Texts[5] = digitalGauge.LastAngle.ToDegrees().ToString(culture); item.Texts[6] = digitalGauge.Minimum.ToString(culture); item.Texts[7] = digitalGauge.Maximum.ToString(culture); item.Texts[8] = digitalGauge.Step.ToString(culture); item.Texts[9] = digitalGauge.Layer.ToString(culture); } if (linearGauge != null) { item.Texts[0] = linearGauge.Subject.ToString(); item.Texts[1] = $"{linearGauge.LocationX.ToString(culture)}, {linearGauge.LocationY.ToString(culture)}"; item.Texts[2] = linearGauge.DaytimeImage; item.Texts[3] = linearGauge.NighttimeImage; item.Texts[4] = linearGauge.TransparentColor.ToString(); item.Texts[5] = linearGauge.Minimum.ToString(culture); item.Texts[6] = linearGauge.Maximum.ToString(culture); item.Texts[7] = $"{linearGauge.DirectionX.ToString(culture)}, {linearGauge.DirectionY.ToString(culture)}"; item.Texts[8] = linearGauge.Width.ToString(culture); item.Texts[9] = linearGauge.Layer.ToString(culture); } if (timetable != null) { item.Texts[0] = $"{timetable.LocationX.ToString(culture)}, {timetable.LocationY.ToString(culture)}"; item.Texts[1] = timetable.Width.ToString(culture); item.Texts[2] = timetable.Height.ToString(culture); item.Texts[3] = timetable.TransparentColor.ToString(); item.Texts[4] = timetable.Layer.ToString(culture); } if (touch != null) { item.Texts[0] = $"{touch.LocationX.ToString(culture)}, {touch.LocationY.ToString(culture)}"; item.Texts[1] = $"{touch.SizeX.ToString(culture)}, {touch.SizeY.ToString(culture)}"; item.Texts[2] = touch.JumpScreen.ToString(culture); item.Texts[3] = touch.SoundIndex.ToString(culture); item.Texts[4] = touch.CommandInfo.Name; item.Texts[5] = touch.CommandOption.ToString(culture); } }