void RedrawNet(DressMatrix in_netType) { PAN_Net.Controls.Clear(); T_Amount.Text = string.Empty; if (in_netType.CellsX.Count == 1 && in_netType.CellsY.Count == 1) { T_Amount.ReadOnly = false; Width = _defaultWidth; Height = _defaultHeight; } else { T_Amount.ReadOnly = true; NetPanel net = new NetPanel(in_netType) { Parent = PAN_Net }; Width = Math.Max(_defaultWidth, net.TotalWidth); Height = Math.Max(_defaultHeight, net.TotalHeight + PAN_SkuWONet.Height); net.Size = new System.Drawing.Size(Math.Min(net.TotalHeight, PAN_Net.Width), PAN_Net.Height); if (_defaultWidth > net.TotalWidth) { net.Location = new System.Drawing.Point(_defaultWidth / 2 - net.TotalWidth / 2, 0); } net.ValueChanged += (s, e) => OnNetValueChange(); } }
void NetToForm() { T_PriceOfPurchase.Text = _article.PriceOfPurchase.ToString(); T_PriceOfSell.Text = _article.PriceOfSell.ToString(); CB_NetType.SelectBizItem(_article.Matrix.Id); RedrawNet(_skuInStock.Article.Matrix); if (_skuInStock.Article.Matrix.CellsX.Count == 1 && _skuInStock.Article.Matrix.CellsY.Count == 1) { T_Amount.Text = _skuInStock[0, 0].ToString(); } else { NetPanel netPan = (NetPanel)PAN_Net.Controls[0]; for (int i = 0; i < _skuInStock.Article.Matrix.CellsX.Count; i++) { for (int j = 0; j < _skuInStock.Article.Matrix.CellsY.Count; j++) { netPan[i, j] = _skuInStock[i, j].Amount; } } } }
string FormToNet() { string err; if (_skuInStock.Article.Matrix.CellsX.Count == 1 && _skuInStock.Article.Matrix.CellsY.Count == 1) { err = TextBoxToCell(T_Amount, _skuInStock[0, 0]); if (err != null) { T_Amount.Focus(); return(c_errInvalidQty); } } else { NetPanel netPan = (NetPanel)PAN_Net.Controls[0]; for (int i = 0; i < _skuInStock.Article.Matrix.CellsX.Count; i++) { for (int j = 0; j < _skuInStock.Article.Matrix.CellsY.Count; j++) { TextBox txtBox = netPan.FindCellTextBox(i, j); err = TextBoxToCell(txtBox, _skuInStock[i, j]); if (err != null) { txtBox.Focus(); return(err); } } } } return(null); }
private void Awake() { panelList = new List <DebugBasePanel>(); panelRect = this.transform.Find("Panel").GetComponent <RectTransform>(); contentPanel = this.transform.Find("Panel/Content").gameObject; togglePanel = this.transform.Find("Panel/TogglePanel").gameObject; logPanel = new LogPanel(this.transform.Find("Panel/Content/LogPanel").gameObject, this); commandPanel = new CommandPanel(this.transform.Find("Panel/Content/CommandPanel").gameObject, this); netPanel = new NetPanel(this.transform.Find("Panel/Content/NetPanel").gameObject, this); panelList.Add(logPanel); panelList.Add(commandPanel); panelList.Add(netPanel); for (int i = 1; i <= 3; i++) { var btnObj = this.transform.Find("Panel/TogglePanel/Toggle" + i); if (btnObj) { int index = i; btnObj.GetComponent <Button>().onClick.AddListener(() => { this.curSelect = index; HideAllPanels(); ShowPanel(index); }); } } btnClick = this.transform.Find("Panel/Button").GetComponent <Button>(); btnClick.onClick.AddListener(() => { if (isHide) { ShowWindow(); } else { HideWindow(); } }); txtArrow = btnClick.gameObject.transform.Find("Text").GetComponent <Text>(); HideWindow(); }