private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { string SideName = comboBox1.SelectedItem.ToString(); int Id = Convert.ToInt32(SideName.Substring(4, 1)) - 1; HObject IntensityImage = null; HObject HeightImage = null; HObject OriginImage = null; if (MyGlobal.ImageMulti.Count >= Id + 1) { IntensityImage = MyGlobal.ImageMulti[Id][0]; if (MyGlobal.globalConfig.enableAlign) { if (MyGlobal.ImageMulti[Id].Length < 3) { MessageBox.Show("请重新加载数据"); return; } HeightImage = MyGlobal.ImageMulti[Id][2]; OriginImage = MyGlobal.ImageMulti[Id][1]; } else { HeightImage = MyGlobal.ImageMulti[Id][1]; OriginImage = null; } } ChangeSide?.Invoke(Id, IntensityImage, HeightImage, OriginImage); }
public override void OnInspectorGUI() { DrawDefaultInspector(); ChangeSide script = (ChangeSide)target; //if (GUILayout.Button("Do arrow function")) // script.DoFunction(); }
private void ChangeRect(Image image, int Position_x, int Position_y, ChangeSide Side) { Graphics Painter = Graphics.FromImage(image); switch (Side) { case ChangeSide.Left: break; case ChangeSide.LeftBottom: break; case ChangeSide.LeftTop: Rect.Y = Position_y; break; case ChangeSide.Bottom: break; case ChangeSide.Top: break; case ChangeSide.Right: if (Position_x < Rect.X) { Rect.Size = new Size(tmpx - Position_x + Rect.Width, Rect.Height); Rect.X = Position_x; //记录现在的位置 tmpx = Position_x; } else { Rect.Size = new Size(Position_x - Rect.X, Rect.Height); } break; case ChangeSide.RightBottom: Rect.Size = new Size(Position_x - Rect.X, Position_y - Rect.Y); break; case ChangeSide.RightTop: Rect.Size = new Size(Position_x - Rect.X, Rect.Height + Rectpoints[5].Y - Position_y); break; } DrawRects(Painter); MainPainter.DrawImage(image, 0, 0); image.Dispose(); }
/// <summary> /// Execute new change, send them, or execute localy, or nothing of that. /// </summary> /// <param name="client">Where potencial new changes should be sent.</param> /// <param name="hash">Hash of change that should be executed.</param> /// <param name="side">Side of </param> /// <param name="sendChange">Determine if it should be send new changes to client.</param> public void ExecuteNewChange(TextWriter client, string hash, ChangeSide side, bool sendChange, Queue <Change> changeCache, Queue <TimeEvent> timeEventCache) { switch (side) { case ChangeSide.Local: case ChangeSide.RemoteSideDisabled: if (sendChange) { lock (LocalChanges) SendChange(client, LocalChanges[hash], LocalChanges[hash].TimeEvent); } break; case ChangeSide.Remote: case ChangeSide.LocalSideDisabled: lock (RemoteChanges) ExecuteChange(RemoteChanges[hash], timeEventCache, changeCache); break; case ChangeSide.NotDecided: using (SideChooseForm choose = new SideChooseForm(LocalChanges[hash], RemoteChanges[hash])) { DialogResult isLocalOne = choose.ShowDialog(); if (isLocalOne == DialogResult.Yes) { SendChange(client, LocalChanges[hash], LocalChanges[hash].TimeEvent); } else if (isLocalOne == DialogResult.No) { ExecuteChange(RemoteChanges[hash], timeEventCache, changeCache); } else { return; } } break; default: break; } }
/// <summary> /// Execute new change, send them, or execute localy, or nothing of that. /// </summary> /// <param name="client">Where potencial new changes should be sent.</param> /// <param name="hash">Hash of change that should be executed.</param> /// <param name="side">Side of </param> /// <param name="sendChange">Determine if it should be send new changes to client.</param> public void ExecuteNewChange(TextWriter client, string hash, ChangeSide side, bool sendChange, Queue<Change> changeCache, Queue<TimeEvent> timeEventCache) { switch (side) { case ChangeSide.Local: case ChangeSide.RemoteSideDisabled: if (sendChange) lock (LocalChanges) SendChange(client, LocalChanges[hash], LocalChanges[hash].TimeEvent); break; case ChangeSide.Remote: case ChangeSide.LocalSideDisabled: lock (RemoteChanges) ExecuteChange(RemoteChanges[hash], timeEventCache, changeCache); break; case ChangeSide.NotDecided: using (SideChooseForm choose = new SideChooseForm(LocalChanges[hash], RemoteChanges[hash])) { DialogResult isLocalOne = choose.ShowDialog(); if (isLocalOne == DialogResult.Yes) SendChange(client, LocalChanges[hash], LocalChanges[hash].TimeEvent); else if (isLocalOne == DialogResult.No) ExecuteChange(RemoteChanges[hash], timeEventCache, changeCache); else return; } break; default: break; } }