public DiagramContainer CreateDecoderContianer() { DiagramContainer decoderContainer = new DiagramContainer() { Header = "Decoder", ItemsCanSelect = false, ItemsCanMove = false, DragMode = ContainerDragMode.ByAnyPoint, ShowHeader = true, CanAttachConnectorBeginPoint = false, CanAttachConnectorEndPoint = false, Width = 120, Height = 230, }; decoderContainer.Items.Add(CreateInputPointShape(new Point(0, 40))); decoderContainer.Items.Add(CreateLabelShape(new Point(12, 30), "input 1", Sides.Left)); decoderContainer.Items.Add(CreateInputPointShape(new Point(0, 140))); decoderContainer.Items.Add(CreateLabelShape(new Point(12, 130), "input 2", Sides.Left)); decoderContainer.Items.Add(CreateOutputPointShape(new Point(110, 20))); decoderContainer.Items.Add(CreateLabelShape(new Point(60, 10), "output 1", Sides.Right)); decoderContainer.Items.Add(CreateOutputPointShape(new Point(110, 70))); decoderContainer.Items.Add(CreateLabelShape(new Point(60, 60), "output 2", Sides.Right)); decoderContainer.Items.Add(CreateOutputPointShape(new Point(110, 120))); decoderContainer.Items.Add(CreateLabelShape(new Point(60, 110), "output 3", Sides.Right)); decoderContainer.Items.Add(CreateOutputPointShape(new Point(110, 170))); decoderContainer.Items.Add(CreateLabelShape(new Point(60, 160), "output 4", Sides.Right)); return(decoderContainer); }
public SocketConnection(String ServerAddress, Int32 ServerPort, Boolean passive, DiagramContainer inContainer, DiagramContainer outContainer, DiagramHandler diagHandler) { try { handler = diagHandler; sendQueue = outContainer; receiveQueue = inContainer; outAddress = IPAddress.Parse(ServerAddress); outEndPoint = new IPEndPoint(outAddress, ServerPort); outConnection = new Socket(outEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); inEndPoint = new IPEndPoint(IPAddress.Loopback, ServerPort); inConnection = new Socket(inEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); inConnection.Bind(inEndPoint); Thread inThread = new Thread(StartInConnection); inThread.Start(); Thread outThread = new Thread(StartOutConnection); outThread.Start(outEndPoint); } catch (FormatException formatEx) { log.Error(formatEx.Message); } catch (SocketException socketEx) { log.Error(socketEx.Message); } }
public NodeTextEditor(DiagramContainer container) { this.container = container; timer = new Timer(); timer.Interval = cursorBlinkPeriod; timer.Tick += new EventHandler(timer_Tick); }
// === END OF PRIVATE === // void Start() { //getting content from database diagramContainer = GetComponent <DiagramContainer>(); //setting cable default color (only in medium and hard) if (level > 1) { conditionCable = "positive"; } //feedback component nTag = new int[5]; for (int i = 0; i < nTag.Length; i++) { nTag[i] = 0; } //adding component name for feedback nCheck = new string[5]; nCheck[0] = "Baterai"; nCheck[1] = "Pengaman"; nCheck[2] = "Switch"; nCheck[3] = "Relay"; nCheck[4] = "Beban"; feedbackIsWrited = false; //set total score, wrong, and high score score = wrong = 0; hiScore = PlayerPrefs.GetInt("hiScore_0" + level.ToString(), 0); hiWrong = PlayerPrefs.GetInt("hiWrong_0" + level.ToString(), 0); Debug.Log(hiScore); Debug.Log(hiWrong); //finding array of gameObject with specific tag, then hide it lineAsset = GameObject.FindGameObjectsWithTag("Line"); lineTotal = lineAsset.Length; nLine = lineTotal; txt_linesRemaining.text = "Sisa kabel : " + nLine; foreach (GameObject line in lineAsset) { line.SetActive(false); } if (level == 3) //finding table for switch { tabel = GameObject.FindGameObjectsWithTag("Tabel"); tabelSwitch = GameObject.FindGameObjectsWithTag("TabelSwitch"); foreach (GameObject tabel in tabelSwitch) { tabel.SetActive(false); } } //hiding gamepanel gamePanel.SetActive(false); } //done
public ActionListener(DiagramContainer container) { this.container = container; moveAction = new MoveAction(container); moveAction.ItemsMoved += new ItemsMovedHandler(OnItemsMoved); selectAction = new SelectionAction(container); selectAction.SelectedItemsChanged += new SelectedItemsChangedHandler(OnSelectionChanged); this.container.MouseDown += new System.Windows.Forms.MouseEventHandler(OnMouseDown); this.container.MouseUp += new System.Windows.Forms.MouseEventHandler(OnMouseUp); this.container.MouseMove += new System.Windows.Forms.MouseEventHandler(OnMouseMove); this.container.MouseClick += new System.Windows.Forms.MouseEventHandler(OnMouseClick); }
public ContainerDrawer(DiagramContainer diagramContainer) { this.diagramContainer = diagramContainer; this.gridDrawer = new GridDrawer(diagramContainer); actionListener = new ActionListener(diagramContainer); linkOrchestrator = new LinkOrchestrator(this); invalidationStrategy = new InvalidationStrategy(this); this.drawings = new List<IDrawing>(); this.selectableDrawings = new List<SelectableDrawing>(); }
private DiagramItem Create() { var diagramContainer = new DiagramContainer(_presenter.Location.X, _presenter.Location.Y, 0, 0); var text = new DiagramShape { Appearance = { Font = new Font("Tahoma", 24F), TextOptions = { HAlignment = HorzAlignment.Near, VAlignment = VertAlignment.Top } }, Content = $" {_presenter.Model.Name}\r\n{Properties.Resources.EntryAutomate}\r\n{Properties.Resources.Connection}\r\n{Properties.Resources.OnUps}\r\n{Properties.Resources.Connection}\r\n{Properties.Resources.Temperature} {_presenter.Temperature} °С \r\n\r\n\r\n", ForegroundId = DiagramThemeColorId.Black, Position = new PointFloat(0F, 0F), Shape = BasicShapes.RoundCornerRectangle, Size = new SizeF(250F, 350F), StrokeId = DiagramThemeColorId.Black }; diagramContainer.Items.AddRange(text, IsEntryAutomateOnLampPresenter.View.Shape, IsNetworkOnLampPresenter.View.Shape, IsPowerOnLampPresenter.View.Shape, IsOnUpsLampPresenter.View.Shape); if (_presenter.IsAlarm) { var alarm = new DiagramShape { Appearance = { Font = new Font("Tahoma", 18F), BackColor = Color.Red }, Content = Properties.Resources.Alarm, ForegroundId = DiagramThemeColorId.Black, Position = new PointFloat(40F, 260F), Size = new SizeF(170F, 75F), StrokeId = DiagramThemeColorId.Black, CanChangeParent = true, CanMove = true }; diagramContainer.Items.Add(alarm); } return(diagramContainer); }
public GridDrawer(DiagramContainer diagramContainer, int gridSize) : this(diagramContainer) { this.gridSize = gridSize; }
public GridDrawer(DiagramContainer diagramContainer) { this.diagramContainer = diagramContainer; }
public void Visualize(object obj) { var penBlack = Color.Black; var penGray = Color.Gray; var penGreen = Color.Green; var penRed = Color.Red; var penYellow = Color.Yellow; var penCornflowerBlue = Color.CornflowerBlue; var fontSerif8 = new Font(FontFamily.GenericSerif, 8); var fontSerif12 = new Font(FontFamily.GenericSerif, 12, FontStyle.Bold); var horzAlign = DevExpress.Utils.HorzAlignment.Near; var centerAlign = DevExpress.Utils.HorzAlignment.Center; if (obj.GetType() == typeof(HeatingPanel)) { var hp = (HeatingPanel)obj; //bound var boundItem = new DiagramShape(BasicShapes.RoundedRectangle, hp.Location[0], hp.Location[1], 100, 150); AdjustItem(boundItem, penCornflowerBlue, penBlack, penBlack, 2, null, horzAlign); //header var headerItem = new DiagramShape(BasicShapes.Rectangle, hp.Location[0] + 15, hp.Location[1] + 10, 70, 20, hp.Name); AdjustItem(headerItem, penCornflowerBlue, penBlack, penCornflowerBlue, 1, fontSerif12, horzAlign); //labels DiagramShape[] labelsItem = new DiagramShape[5]; for (int i = 0; i < 5; i++) { labelsItem[i] = new DiagramShape(BasicShapes.Rectangle, hp.Location[0] + 10, hp.Location[1] + 30 + i * 15, 60, 10); AdjustItem(labelsItem[i], penCornflowerBlue, penBlack, penCornflowerBlue, 1, fontSerif8, horzAlign); } labelsItem[0].Content = "Вв. автомат"; labelsItem[1].Content = "Связь"; labelsItem[2].Content = "Питание"; labelsItem[3].Content = "На ИБП"; labelsItem[4].Content = "Темп. "; //values of labels DiagramShape[] circItem = new DiagramShape[4]; for (int i = 0; i < 4; i++) { circItem[i] = new DiagramShape(BasicShapes.Ellipse, hp.Location[0] + 80, hp.Location[1] + 30 + i * 15, 10, 10); circItem[i].Appearance.BorderColor = penBlack; } //temperature var tempItem = new DiagramShape(BasicShapes.Rectangle, hp.Location[0] + 40, hp.Location[1] + 90, 40, 10, hp.Temperature + " C"); AdjustItem(tempItem, penCornflowerBlue, penBlack, penCornflowerBlue, 1, null, horzAlign); //alarm var alarmItem = new DiagramShape(BasicShapes.Rectangle, hp.Location[0] + 10, hp.Location[1] + 110, 80, 30, "Авария"); AdjustItem(alarmItem, Color.Red, penBlack, penBlack, 2, null, centerAlign); //backgroung for value of labels int[] values = new int[4] { hp.IsEntryAutomateOn, hp.IsNetworkOn, hp.IsPowerOn, hp.IsOnUps }; for (int i = 0; i < values.Length; i++) { if (values[i] == -1) { circItem[i].Appearance.BackColor = penGray; } else if (values[i] == 0) { circItem[i].Appearance.BackColor = penRed; } else { circItem[i].Appearance.BackColor = penGreen; } } //Add all items in one adjust container DiagramContainer container = new DiagramContainer(); container.ItemsCanMove = false; container.ItemsCanSelect = false; container.Items.AddRange(boundItem, headerItem, labelsItem[0], labelsItem[1], labelsItem[2], labelsItem[3], labelsItem[4], circItem[0], circItem[1], circItem[2], circItem[3], tempItem); //show label of alarm if (hp.IsInAlarm == true) { container.Items.Add(alarmItem); } diagramControl.Items.Add(container); } else if (obj.GetType() == typeof(HeatingLine)) { var hl = (HeatingLine)obj; var item1 = new DiagramShape(BasicShapes.Rectangle, hl.Location[0], hl.Location[1], 70, 40, hl.Temperature); AdjustItem(item1, penBlack, penBlack, penBlack, 2, null, centerAlign); //background of heatingLine if (hl.State == "GoodOrOff") { item1.Appearance.BackColor = penGreen; } else if (hl.State == "Warning") { item1.Appearance.BackColor = penYellow; } else { item1.Appearance.BackColor = penRed; } diagramControl.Items.Add(item1); } else { var sensor = (Sensor)obj; var item1 = new DiagramShape(BasicShapes.RoundedRectangle, sensor.Location[0], sensor.Location[1], 70, 40, sensor.Temperature); AdjustItem(item1, penBlack, penBlack, penBlack, 2, null, centerAlign); //background of sensor if (sensor.State == "GoodOrOff") { item1.Appearance.BackColor = penGreen; } else if (sensor.State == "Warning") { item1.Appearance.BackColor = penYellow; } else { item1.Appearance.BackColor = penRed; } diagramControl.Items.Add(item1); } }
public void SetUp() { Console.WriteLine(MethodBase.GetCurrentMethod().Name); _container = new DiagramContainer(); }
public SelectionAction(DiagramContainer container) { this.container = container; selectedDrawings = new List<SelectableDrawing>(); removedFromSelection = new List<SelectableDrawing>(); }
public MoveAction(DiagramContainer container) { actionStarted = false; this.container = container; drawingsToMove = new List<MovableDrawing>(); }