예제 #1
0
        /// <summary>
        /// 当表内选择元素变化时触发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DG_List_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // 若当前窗口为停靠状态,可能会覆盖到导航的位置,
            // 所以先将窗口固定,保证主界面的完整显示
            if (!parent.MainWindow.LAReplace.IsFloat &&
                !parent.MainWindow.LAReplace.IsDock)
            {
                LayoutSetting.AddDefaultDockWidthAnchorable(
                    "替换", parent.MainWindow.LAReplace.AutoHideWidth.ToString());
                LayoutSetting.AddDefaultDockHeighAnchorable(
                    "替换", parent.MainWindow.LAReplace.AutoHideHeight.ToString());
                parent.MainWindow.LAReplace.ToggleAutoHide();
            }
            // 未选择元素则不导航
            if (DG_List.SelectedIndex < 0)
            {
                return;
            }
            // 导航到选择元素对应的位置
            ReplaceElement             fele    = items[DG_List.SelectedIndex];
            BaseViewModel              bvmodel = fele.BVModel;
            int                        x       = bvmodel.X;
            int                        y       = bvmodel.Y;
            string                     diagram = fele.Diagram;
            int                        network = int.Parse(fele.Network);
            NavigateToNetworkEventArgs _e      = new NavigateToNetworkEventArgs(network, diagram, x, y);

            parent.NavigateToNetwork(_e);
        }
예제 #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="_lnvmodel">网络的显示模型</param>
 /// <param name="_element">要替换的列表元素</param>
 /// <param name="_command">替换命令</param>
 public NetworkReplaceElementsCommand_ForReplaceWindow
 (
     LadderNetworkViewModel _lnvmodel,
     ReplaceElement _element,
     NetworkReplaceElementsCommand _command
 )
 {
     lnvmodel = _lnvmodel;
     Element  = _element;
     BVM_old  = _command.OldElements.First();
     BVM_new  = _command.NewElements.First();
 }
예제 #3
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="_lnvmodel">网络的显示模型</param>
 /// <param name="_element">要替换的列表元素</param>
 /// <param name="_BVM_old">旧的元件</param>
 /// <param name="_BVM_new">新的元件</param>
 public NetworkReplaceElementsCommand_ForReplaceWindow
 (
     LadderNetworkViewModel _lnvmodel,
     ReplaceElement _element,
     BaseViewModel _BVM_old,
     BaseViewModel _BVM_new
 )
 {
     lnvmodel = _lnvmodel;
     Element  = _element;
     BVM_old  = _BVM_old;
     BVM_new  = _BVM_new;
 }