private void DataGridViewGatherForm_Load(object sender, EventArgs e) { //排序输出 SetDataGridViewStyles2(); int p = MainForm.MyListVisGather.Count; VisGather[] VisGatherArray = new VisGather[p]; MySortedListVisGather.Clear(); for (int i = 0; i < p; i++) { VisGatherArray[i] = MainForm.MyListVisGather[p - i - 1]; } MySortedListVisGather.AddRange(VisGatherArray); GatherDataGridView.RowCount = VisGatherArray.Length + 1; if (VisGatherArray.Length > 0) { //GatherDataGridView.Rows[0].Selected = true; GatherDataGridView.CurrentCell = GatherDataGridView[0, 0]; GatherDataGridView.Refresh(); } //GatherDataGridView.Sort(GatherDataGridView.Columns[0], ListSortDirection.Descending); }
private void UpdateCallPostAlarm(object NewCallCount) { string AlarmSetStr = (string)NewCallCount; int mCount = 0; if (AlarmSetStr.Length > 60) { mCount = 60; } else { mCount = AlarmSetStr.Length; } string NotifyStr = AlarmSetStr.Substring(0, mCount); //RefreshPrimeNotifyIcon("PostAlarm:" + NotifyStr);//发通知 RefreshPrimeNotifyIcon2("PostAlarm", AlarmSetStr); int index = AlarmSetStr.IndexOf(":"); string mFlagID = AlarmSetStr.Substring(0, index); AlarmSetStr = AlarmSetStr.Substring(index + 1); int FlagIndex = AlarmSetStr.IndexOf("@"); string mAccountID = AlarmSetStr.Substring(FlagIndex + 1, 12); VisGather MyVisGather = new VisGather(); FlowID++; MyVisGather.FlowID = FlowID.ToString(); MyVisGather.TypeID = "10"; MyVisGather.FlagID = mFlagID; MyVisGather.AccountID = mAccountID; MyVisGather.InforStr = AlarmSetStr; MyListVisGather.Add(MyVisGather); MFuncDataGridGatherInit(); MyDataGridViewGatherForm.SetDataGridView(); }
public void SetDataGridView() { //排序输出 int p = MainForm.MyListVisGather.Count; VisGather[] VisGatherArray = new VisGather[p]; MySortedListVisGather.Clear(); for (int i = 0; i < p; i++) { VisGatherArray[i] = MainForm.MyListVisGather[p - i - 1]; } MySortedListVisGather.AddRange(VisGatherArray); GatherDataGridView.RowCount = VisGatherArray.Length + 1; int m = VisGatherArray.Length; GatherDataGridView.CurrentCell = GatherDataGridView[0, 0]; GatherDataGridView.Rows[0].Selected = true; GatherDataGridView.Refresh(); //this.Refresh(); }
private void MFuncDataGridGatherInit() { GatherDataGrid.TableStyles.Clear(); if (MyListVisGather.Count > 10) { //var SortedListVisGather = from One in MyListVisGather orderby FlowID descending select One; //排序输出 int p = MyListVisGather.Count; VisGather[] VisGatherArray = new VisGather[p]; List <VisGather> MySortedListVisGather = new List <VisGather>(); for (int i = 0; i < p; i++) { VisGatherArray[i] = MyListVisGather[p - i - 1]; } MySortedListVisGather.AddRange(VisGatherArray); GatherDataGrid.DataSource = MySortedListVisGather; MFuncDataGridGatherStyles(MyListVisGather.Count); GatherDataGrid.Select(0); GatherDataGrid.Refresh(); } else { //原生输出 GatherDataGrid.DataSource = MyListVisGather; MFuncDataGridGatherStyles(MyListVisGather.Count); if (MyListVisGather.Count > 0) { int m = MyListVisGather.Count - 1; GatherDataGrid.CurrentRowIndex = m; GatherDataGrid.Select(m); } GatherDataGrid.Refresh(); } }
private void UpdateCallSendRunState(object NewCallCount) { string RunStateStr = (string)NewCallCount; int mCount = 0; if (RunStateStr.Length > 64) { mCount = 62; } else { mCount = RunStateStr.Length; } string NotifyStr = RunStateStr.Substring(0, mCount); //RefreshPrimeNotifyIcon("SendRunState:" + NotifyStr);//发通知 RefreshPrimeNotifyIcon2("SendRunState", RunStateStr); int FlagIndex = RunStateStr.IndexOf("@"); string mAccountID = RunStateStr.Substring(FlagIndex + 1, 12); VisGather MyVisGather = new VisGather(); FlowID++; MyVisGather.FlowID = FlowID.ToString(); MyVisGather.TypeID = "20"; MyVisGather.FlagID = "100"; MyVisGather.AccountID = mAccountID; MyVisGather.InforStr = RunStateStr; MyListVisGather.Add(MyVisGather); MFuncDataGridGatherInit(); MyDataGridViewGatherForm.SetDataGridView(); }
private int XMFuncDataGridGatherFillX(string GatherList) { if (GatherList != null) { if (GatherList.Length > 10) { // MyListVisGather.Clear(); string TempVisGather; int VisGatherIndex; int InnerVisGatherIndex; TempVisGather = GatherList; VisGatherIndex = TempVisGather.IndexOf("^^"); while (VisGatherIndex != -1) { TempVisGather = TempVisGather.Substring(2); VisGather NewVisGather = new VisGather(); int FlagIndex = TempVisGather.IndexOf("@"); NewVisGather.AccountID = TempVisGather.Substring(FlagIndex + 1, 12); InnerVisGatherIndex = TempVisGather.IndexOf(";"); NewVisGather.CreateDate = TempVisGather.Substring(0, InnerVisGatherIndex); //NewVisGather.CreateDate = NewVisGather.CreateDate.TrimStart(); //NewVisGather.CreateDate = NewVisGather.CreateDate.TrimStart(); if (NewVisGather.CreateDate.Length == 22) { NewVisGather.CreateDate = NewVisGather.CreateDate + "0";//补齐操作 } else { if (NewVisGather.CreateDate.Length == 21) { NewVisGather.CreateDate = NewVisGather.CreateDate + "00";//补齐操作 } } TempVisGather = TempVisGather.Substring(InnerVisGatherIndex + 1); InnerVisGatherIndex = TempVisGather.IndexOf(";"); NewVisGather.FlowID = TempVisGather.Substring(0, InnerVisGatherIndex); TempVisGather = TempVisGather.Substring(InnerVisGatherIndex + 1); InnerVisGatherIndex = TempVisGather.IndexOf(";"); NewVisGather.TypeID = TempVisGather.Substring(0, InnerVisGatherIndex); TempVisGather = TempVisGather.Substring(InnerVisGatherIndex + 1); InnerVisGatherIndex = TempVisGather.IndexOf(";"); NewVisGather.FlagID = TempVisGather.Substring(0, InnerVisGatherIndex); TempVisGather = TempVisGather.Substring(InnerVisGatherIndex + 1); VisGatherIndex = TempVisGather.IndexOf("^^"); if (VisGatherIndex != -1) { NewVisGather.InforStr = TempVisGather.Substring(0, VisGatherIndex); TempVisGather = TempVisGather.Substring(VisGatherIndex); MyListVisGather.Add(NewVisGather); } else { NewVisGather.InforStr = TempVisGather.Substring(0); MyListVisGather.Add(NewVisGather); break; } } MFuncDataGridGatherInit(); return(100); } else { return(200); } } else { return(200); } }