コード例 #1
0
        /// <summary>
        /// 初始化右边的控件容器
        /// </summary>
        /// <returns></returns>
        private Panel initControlPanel()
        {
            Panel panel = new ControlTree().ControPanel;

            panel.BorderStyle = BorderStyle.FixedSingle;
            panel.Location    = new Point(treeView.Location.X + treeView.Width - 1, 0);
            panel.Size        = new Size(600, treeView.Height);
            return(panel);
        }
コード例 #2
0
        private void LoadProperties(TreeListNode node)
        {
            SYS_Quyen quyen = (SYS_Quyen)ControlTree.GetDataRecordByNode(node);

            if (quyen != null)
            {
                Entities db = new Entities();
                ThuocTinhCtrl.LoadLookUpEdit(repositoryItemLookUpEdit1, quyen.Loai_dieu_khien, db);
                VaiTroQuyenCtrl.LoadBindingSource(sYSVaiTroQuyenBindingSource, ledVaiTro.EditValue, quyen.ID_quyen, db);
            }
        }
コード例 #3
0
        public void FindTextBoxRecursive(string id, bool shouldFind)
        {
            Control parent  = new ControlTree();
            TextBox control = parent.FindChild <TextBox>(id);
            bool    found   = control != null;

            Assert.AreEqual(shouldFind, found);
            if (found)
            {
                Assert.AreEqual(id, control.ID);
            }
        }
コード例 #4
0
        /// <summary>
        /// 初始化左边的选项树
        /// </summary>
        /// <returns></returns>
        private TreeView initTreeView()
        {
            TreeView tree = new ControlTree().treeView;
            // 字体
            Font font = new Font(FontFamily.GenericSerif, 10, FontStyle.Regular);

            tree.Font = font;
            // 大小
            tree.Size = new Size(150, this.ClientSize.Height);
            // 边框
            tree.BorderStyle = BorderStyle.None;
            // 相对位置
            tree.Location = new Point(0, 0);
            // 锚定
            tree.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
            return(tree);
        }
コード例 #5
0
        /// <summary>
        ///     Initializes a new instance of the <see cref = "BaseProdControl" /> class.
        /// </summary>
        /// <param name = "prodWindow">The prod window.</param>
        /// <param name = "treePosition">The tree position.</param>
        public BaseProdControl(ProdWindow prodWindow, int treePosition)
        {
            if (prodWindow == null)
            {
                throw new ProdOperationException("ProdWindow cannot be null");
            }

            try
            {
                ControlTree tree = new ControlTree((IntPtr)prodWindow.UIAElement.Current.NativeWindowHandle);
                UIAElement = tree.FindElement(treePosition);
                GetSupportedProperties();
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
        }
コード例 #6
0
        private void Slider_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Released)
            {
                return;
            }

            var thumb = ControlTree.FindChild <Track>(sender as Slider)?.Thumb;

            if (thumb == null || thumb.IsDragging || !thumb.IsMouseOver)
            {
                return;
            }

            thumb.RaiseEvent(new MouseButtonEventArgs(e.MouseDevice, e.Timestamp, MouseButton.Left)
            {
                RoutedEvent = UIElement.MouseLeftButtonDownEvent
            });
        }
コード例 #7
0
        private void btnSaveProperties_Click(object sender, EventArgs e)
        {
            if (ledVaiTro.EditValue == null || ledVaiTro.EditValue.Equals(0))
            {
                return;
            }

            SYS_Quyen quyen = (SYS_Quyen)ControlTree.GetDataRecordByNode(ControlTree.FocusedNode);
            int       rs    = VaiTroQuyenCtrl.Update((int)ledVaiTro.EditValue, quyen.ID_quyen, grvThuocTinh);

            if (rs == 0)
            {
                XtraMessageBox.Show("Không có thay đổi nào được lưu. Vui lòng thử lại!", "Lưu các thuộc tính", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                XtraMessageBox.Show("Lưu các thuộc tính thành công!", "Lưu các thuộc tính", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            btnRefreshProperties.PerformClick();
        }
コード例 #8
0
        /// <summary>
        /// Gets the handle from controls position in the forms UI control tree.
        /// </summary>
        /// <param name="windowHandle">The applications window handle.</param>
        /// <param name="position">The position of the control.</param>
        /// <returns>
        /// The window handle to the selected control
        /// </returns>
        /// <exception cref="ProdOperationException">Examine inner exception</exception>
        /// <remarks>
        /// The position of the control tree can be found through the use of ProdSpy. This function is especially useful for those controls that have no name, label, or resourceID
        /// However, WPF controls do NOT have a handle, so this will return a 0
        /// </remarks>
        public static IntPtr GetHandleFromTree(IntPtr windowHandle, int position)
        {
            try
            {
                ControlTree tree = new ControlTree(windowHandle);

                return((IntPtr)tree.Find(position));
            }
            catch (InvalidOperationException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ArgumentException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
        }
コード例 #9
0
        private void btnCopyProperties_Click(object sender, EventArgs e)
        {
            if (ledVaiTro.EditValue == null || ledVaiTro.EditValue.Equals(0))
            {
                return;
            }

            SYS_Quyen quyen = (SYS_Quyen)ControlTree.GetDataRecordByNode(ControlTree.FocusedNode);
            int       rs    = VaiTroQuyenCtrl.Update((int)ledVaiTro.EditValue, quyen.ID_quyen, grvThuocTinh);

            if (rs == 0)
            {
                XtraMessageBox.Show("Không có thay đổi nào được lưu!", "Lưu các thuộc tính", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            if (XtraMessageBox.Show("Bạn có muốn sao chép các thuộc tính của quyền \"" + quyen.Ten_quyen + "\" cho các quyền cùng loại không?", "Xác nhận sao chép", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (ControlTree.ActiveFilterString == "")
                {
                    rs = VaiTroQuyenCtrl.Copy((int)ledVaiTro.EditValue, quyen.ID_quyen, (List <SYS_Quyen>)sYSQuyenBindingSource.DataSource);
                }
                else
                {
                    rs = VaiTroQuyenCtrl.Copy((int)ledVaiTro.EditValue, quyen.ID_quyen, TreeHelper.GetVisibleNodesData <SYS_Quyen>(ControlTree));
                }

                if (rs > 0)
                {
                    XtraMessageBox.Show("Sao chép các thuộc tính của quyền thành công", "Sao chép các thuộc tính", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    XtraMessageBox.Show("Không có thuộc tính nào được sao chép!", "Sao chép các thuộc tính", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
コード例 #10
0
 private void btnCollapseAll_Click(object sender, EventArgs e)
 {
     ControlTree.CollapseAll();
 }
コード例 #11
0
 private void btnExpandAll_Click(object sender, EventArgs e)
 {
     ControlTree.ExpandAll();
 }
コード例 #12
0
 public override void RemoveLogicalNode()
 {
     AssemblySupport.CloseAssembly(this);
     ControlTree.RemoveAssy(_assembly);
     base.RemoveLogicalNode();
 }
コード例 #13
0
ファイル: User.cs プロジェクト: CPCTF2021/Visualizer
 public void Initialize()
 {
     controlTree = GetComponent <ControlTree>();
     userIcon.SetUpVector(transform.position.normalized);
 }