private void SetChangeReceiveCallBack(CustomReceiveResult info) { if (info.IsOK==true) { #region 记录相关 ObservableCollection<ElementSizeInfo> elementSizeCollection = new ObservableCollection<ElementSizeInfo>(); ObservableCollection<ElementMoveInfo> elementMoveCollection = new ObservableCollection<ElementMoveInfo>(); ElementSizeInfo elementSizeinfo = new ElementSizeInfo(); elementSizeinfo.Element = _selectedElementCollection[0]; Size oldSize = new Size(_selectedElementCollection[0].Width, _selectedElementCollection[0].Height); elementSizeinfo.OldSize = oldSize; #endregion for (int i = 0; i < _selectedElementCollection.Count; i++) { _selectedElementCollection[i].Height = info.Height; _selectedElementCollection[i].Width = info.Width; } IRectElement rectElement = _selectedElementCollection[0]; //组框大小等于选中的和没有选中的 if (rectElement.GroupName != -1) { Rect noSelectedElementRect = _currentSelectedElement[rectElement.GroupName].NoSelectedElementRect; Rect SelectedElementRect = new Rect(rectElement.X, rectElement.Y, rectElement.Width, rectElement.Height); Rect groupSize = new Rect(); if (noSelectedElementRect.Height == 0 && noSelectedElementRect.Width == 0) { groupSize = SelectedElementRect; } else { groupSize = Rect.Union(SelectedElementRect, noSelectedElementRect); } #region 记录相关 ElementMoveInfo groupMoveInfo = new ElementMoveInfo(); groupMoveInfo.Element = _groupframeList[rectElement.GroupName]; groupMoveInfo.OldPoint = new Point(_groupframeList[rectElement.GroupName].X, _groupframeList[rectElement.GroupName].Y); ElementSizeInfo groupSizeinfo = new ElementSizeInfo(); groupSizeinfo.Element = _groupframeList[rectElement.GroupName]; groupSizeinfo.OldSize = new Size(_groupframeList[rectElement.GroupName].Width, _groupframeList[rectElement.GroupName].Height); #endregion _groupframeList[rectElement.GroupName].X = groupSize.X; _groupframeList[rectElement.GroupName].Y = groupSize.Y; _groupframeList[rectElement.GroupName].Width = groupSize.Width; _groupframeList[rectElement.GroupName].Height = groupSize.Height; #region 记录相关 groupSizeinfo.NewSize = new Size(_groupframeList[rectElement.GroupName].Width, _groupframeList[rectElement.GroupName].Height); groupMoveInfo.NewPoint = new Point(_groupframeList[rectElement.GroupName].X, _groupframeList[rectElement.GroupName].Y); elementMoveCollection.Add(groupMoveInfo); elementSizeCollection.Add(groupSizeinfo); #endregion GetCurrentElementInfo(); } elementSizeinfo.NewSize = new Size(elementSizeinfo.Element.Width, elementSizeinfo.Element.Height); elementSizeCollection.Add(elementSizeinfo); ElementSizeAction elementSizeAction = new ElementSizeAction(elementSizeCollection); ElementMoveAction elementMoveAction = new ElementMoveAction(elementMoveCollection); using (Transaction.Create(SmartLCTActionManager)) { SmartLCTActionManager.RecordAction(elementSizeAction); SmartLCTActionManager.RecordAction(elementMoveAction); } } }
private void OnCmdChangeReceiveSize() { CustomReceiveResult info = new CustomReceiveResult(); info.Height = (int)_selectedElementCollection[0].Height; info.Width = (int)_selectedElementCollection[0].Width; NotificationMessageAction<CustomReceiveResult> nsa = new NotificationMessageAction<CustomReceiveResult>(this, info, MsgToken.MSG_SHOWSETCUSTOMRECEIVESIZE, SetChangeReceiveCallBack); Messenger.Default.Send(nsa, MsgToken.MSG_SHOWSETCUSTOMRECEIVESIZE); }
private void OnCustomReceiveSize() { if (SelectedScannerConfigInfo == null) { return; } if (SelectedScannerConfigInfo.ScanBdSizeType == ScannerSizeType.Custom) { CustomReceiveResult info = new CustomReceiveResult(); info.Width = 64; info.Height = 64; NotificationMessageAction<CustomReceiveResult> nsa = new NotificationMessageAction<CustomReceiveResult>(this, info, MsgToken.MSG_SHOWSETCUSTOMRECEIVESIZE, SetCustomReceiveNotifycationCallBack); Messenger.Default.Send(nsa, MsgToken.MSG_SHOWSETCUSTOMRECEIVESIZE); } }
private void SetCustomReceiveNotifycationCallBack(CustomReceiveResult info) { if (info.IsOK != true) { if (ScannerCofigCollection != null && ScannerCofigCollection.Count == 1) { this.SelectedScannerConfigInfo = null; } else { this.SelectedScannerConfigInfo = ScannerCofigCollection[0]; } } else { ScannerCofigInfo scanConfig = new ScannerCofigInfo(); ScanBoardProperty scanBdProp = new ScanBoardProperty(); scanBdProp.StandardLedModuleProp.DriverChipType = ChipType.Unknown; scanBdProp.ModCascadeType = ModuleCascadeDiretion.Unknown; scanBdProp.Width = info.Width; scanBdProp.Height = info.Height; scanConfig.ScanBdProp = scanBdProp; scanConfig.DisplayName = info.Width.ToString() + "_" + info.Height.ToString(); scanConfig.ScanBdSizeType = ScannerSizeType.NoCustom; int index = -1; for (int i = 0; i < ScannerCofigCollection.Count; i++) { if (ScannerCofigCollection[i].DisplayName == scanConfig.DisplayName) { index = i; break; } } if (index >= 0) { SelectedScannerConfigInfo = ScannerCofigCollection[index]; } else { ScannerCofigCollection.Insert(ScannerCofigCollection.Count - 1, scanConfig); } SelectedScannerConfigInfo = scanConfig; } }
private void OnShowCustomReceiveSize(NotificationMessageAction<CustomReceiveResult> str) { CustomReceiveResult info = (CustomReceiveResult)str.Target; Window_SetCustomReceive setCustomReceiveWin = new Window_SetCustomReceive(info.Width,info.Height); bool? res = setCustomReceiveWin.ShowDialog(); int width = 0; int height = 0; setCustomReceiveWin.GetSetSize(out width, out height); CustomReceiveResult param = new CustomReceiveResult() { IsOK = res, Width = width, Height = height }; str.Execute(param); }