private void commit() { StationDataMode dianfxdata = new StationDataMode() { HatProperty = Hat, LengthProperty = (float)(LeftDis + RightDis), RealLength = (float)(LeftDis + RightDis), PathDataProperty = "2:1 0:#00DC5625:#FF4500:M334,361 L436,410 M334,410 L436,361", PositionProperty = (float)leftedgepos, ScaleProperty = 10, SectionNumProperty = middleSecnum, SelectedProperty = false, //标记类型:分相名称:分相左端里程:分相中心里程:分相右侧里程:分相长度 StationNameProperty = string.Format("3:{0}:{1}+{2}:{3}+{4}:{5}+{6}:{7}", Name, leftedgepos.ToString("F3"), leftedgeSecnum.ToString(), middlepos.ToString("F3"), middleSecnum.ToString(), rightedgepos.ToString("F3"), rightedgeSecnum.ToString(), (LeftDis + RightDis).ToString("F3")), Type = DataType.Single }; if (!isupdata) { MessengerInstance.Send <StationDataMode>(dianfxdata, "InsertDianfx"); } else { MessengerInstance.Send <StationDataMode>(dianfxdata, "UpdataDianfx"); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { StationDataMode sdm = value as StationDataMode; if (sdm == null) { return("无"); } else { switch (sdm.StationNameProperty.Split(':')[0]) { case "1": return("进出站信号机"); case "2": return("通过信号机"); case "3": return("电分相"); default: return("区间"); } } }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { StationDataMode sdm = values[0] as StationDataMode; int div = (int)values[1]; if (sdm == null) { return(0); } else { if (sdm.StationNameProperty.StartsWith("3") || sdm.StationNameProperty.Equals("Q:0")) { return((sdm.LengthProperty * sdm.ScaleProperty / div).ToString()); } else { return(((sdm.RealLength * sdm.ScaleProperty) / div).ToString()); } } } catch { return(0); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { StationDataMode sdm = value as StationDataMode; if (sdm == null) { return("路段号:无"); } else { return(string.Format("路段号:{0}", sdm.SectionNumProperty.ToString())); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { StationDataMode sdm = value as StationDataMode; string[] parts = { }; if (sdm == null) { return("无"); } else { parts = sdm.PositionProperty.ToString("F3").Split('.'); return(string.Format("{0} {1}+{2}", sdm.HatProperty, parts[0], Math.Round(sdm.PositionProperty - int.Parse(parts[0]), 3).ToString("F3").Substring(2))); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { StationDataMode sdm = value as StationDataMode; if (sdm == null || string.IsNullOrEmpty(sdm.StationNameProperty) || sdm.StationNameProperty.StartsWith("Q")) { return("无"); } else { return(sdm.StationNameProperty.Split(':')[1]); } } catch { return("无"); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { StationDataMode sdm = value as StationDataMode; if (sdm == null) { return("0"); } else { if (sdm.StationNameProperty.StartsWith("3") || sdm.StationNameProperty.Equals("Q:0")) { return((sdm.LengthProperty * sdm.ScaleProperty).ToString()); } else { return((sdm.RealLength * sdm.ScaleProperty).ToString()); } } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { StationDataMode sdm = value as StationDataMode; if (sdm == null || sdm.Type != DataType.Single) { return(0); } else { if (sdm.StationNameProperty.StartsWith("Q")) { return(0); } else { return(4); } } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { string position = string.Empty; StationDataMode sdm = value as StationDataMode; if (sdm != null) { if (sdm.Type == DataType.Position) { position = string.Format("{0} {1}", sdm.HatProperty, sdm.PositionProperty.ToString()); } } return(position); } catch { return(string.Empty); } }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { IDataModel idm = (IDataModel)value; StationDataMode signalmode = null; try { if (idm.LengthProperty * idm.ScaleProperty < 300) { return(string.Empty); } switch (idm.Type) { case DataType.SingleS: case DataType.Single: { signalmode = (StationDataMode)idm; if (signalmode.StationNameProperty.StartsWith("Q")) { if (signalmode.StationNameProperty.Split('+')[1].StartsWith("3")) { return((signalmode.LengthProperty * idm.ScaleProperty).ToString("F0")); } return((signalmode.RealLength * idm.ScaleProperty).ToString("F0")); } return(string.Empty); } case DataType.Station: { signalmode = (StationDataMode)idm; if (signalmode.StationNameProperty.Equals("区间")) { return((signalmode.RealLength * idm.ScaleProperty).ToString("F3")); } return(string.Empty); } case DataType.Bridge: return(string.Empty); case DataType.Tunel: return(string.Empty); case DataType.Podu: return((idm.LengthProperty * idm.ScaleProperty).ToString("F3")); case DataType.Quxian: return((idm.LengthProperty * idm.ScaleProperty).ToString("F0")); case DataType.Break: return(idm.SectionNumProperty.ToString()); case DataType.Position: return(string.Format("{0} {1}", idm.HatProperty, idm.PositionProperty.ToString("F0"))); default: return(string.Empty); } } catch { return("Error"); } }
private void checkMenuFunc(ObservableCollection <IDataModel> items) { string type = string.Empty; int index = 0; StationDataMode nextsdm; DfxMenuVisibility = System.Windows.Visibility.Collapsed; XhMenuVisibility = System.Windows.Visibility.Collapsed; QjMenuVisibility = System.Windows.Visibility.Collapsed; foreach (IDataModel item in items) { StationDataMode sdm = item as StationDataMode; index = DataCollection.IndexOf(item); if (sdm != null) { type = sdm.StationNameProperty.Split('|')[0]; if (type.StartsWith("Q")) { QjMenuVisibility = System.Windows.Visibility.Visible; if (items.Count > 1) { XhMenuVisibility = System.Windows.Visibility.Collapsed; DfxMenuVisibility = System.Windows.Visibility.Collapsed; IsSingleQJ = false; if (TypeNum == (int)DataType.SingleS) { if (index == DataCollection.Count - 1) { QjMenuVisibility = System.Windows.Visibility.Collapsed; break; } nextsdm = DataCollection[index + 1] as StationDataMode; if (nextsdm.StationNameProperty.Split(':')[0].Equals("1") || nextsdm.StationNameProperty.Split(':')[0].Equals("3")) { QjMenuVisibility = System.Windows.Visibility.Collapsed; break; } } else if (TypeNum == (int)DataType.Single) { if (index == 0 || index == 1) { QjMenuVisibility = System.Windows.Visibility.Collapsed; break; } nextsdm = DataCollection[index - 1] as StationDataMode; if (nextsdm.StationNameProperty.Split(':')[0].Equals("1") || nextsdm.StationNameProperty.Split(':')[0].Equals("3")) { QjMenuVisibility = System.Windows.Visibility.Collapsed; break; } } QjMenuVisibility = System.Windows.Visibility.Visible; } else { IsSingleQJ = true; } XhMenuVisibility = System.Windows.Visibility.Collapsed; DfxMenuVisibility = System.Windows.Visibility.Collapsed; } else if (type.StartsWith("3")) { DfxMenuVisibility = System.Windows.Visibility.Visible; if (items.Count > 1) { DfxMenuVisibility = System.Windows.Visibility.Collapsed; XhMenuVisibility = System.Windows.Visibility.Collapsed; QjMenuVisibility = System.Windows.Visibility.Collapsed; break; } XhMenuVisibility = System.Windows.Visibility.Collapsed; QjMenuVisibility = System.Windows.Visibility.Collapsed; } else if (type.StartsWith("1")) { XhMenuVisibility = System.Windows.Visibility.Collapsed; DfxMenuVisibility = System.Windows.Visibility.Collapsed; QjMenuVisibility = System.Windows.Visibility.Collapsed; break; } else { XhMenuVisibility = System.Windows.Visibility.Visible; if (DfxMenuVisibility == System.Windows.Visibility.Visible || QjMenuVisibility == System.Windows.Visibility.Visible) { XhMenuVisibility = System.Windows.Visibility.Collapsed; } DfxMenuVisibility = System.Windows.Visibility.Collapsed; QjMenuVisibility = System.Windows.Visibility.Collapsed; } } } if (XhMenuVisibility == System.Windows.Visibility.Visible) { if (items.Count > 1) { CanMoveSignal = false; } else { CanMoveSignal = true; } } }