Пример #1
0
        internal void RefreshModel(TEntityAction entityAction)
        {
            if (entityAction.NotNull())
            {
                var gadgets = new Collection <TActionComponent> ();
                TActionConverter.Collection(TCategory.Material, gadgets, entityAction);

                if (gadgets.Any())
                {
                    foreach (var component in gadgets)
                    {
                        var selection = TSelectionInfo.Create(component.Models.GadgetMaterialModel.GadgetName, component.Models.GadgetMaterialModel.Id, component.Models.GadgetMaterialModel.Enabled);
                        selection.SetImage(component.Models.GadgetMaterialModel.GetImage());

                        entityAction.SupportAction.SelectionCollection.Add(selection);
                    }

                    ComponentModelProperty.ValidateModel(true);
                    ComponentModelProperty.ExtensionModel.SelectModel(TCategory.Target, entityAction); // update Selection Property (Material list)

                    AlertsModel.Select(isOpen: false);                                                 // default
                }

                else
                {
                    ComponentModelProperty.ValidateModel(false);

                    // show alerts
                    AlertsModel.Select(TAlertsModel.TKind.Warning);
                    AlertsModel.Select(Properties.Resource.RES_EMPTY, Properties.Resource.RES_LIST_EMPTY);
                    AlertsModel.Select(isOpen: true);
                }
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            TSelectionInfo tSelInfo = null;

            this.WindowState = FormWindowState.Minimized;
            try
            {
                tSelInfo = (TSelectionInfo)m_tSelection.Start((int)TS_SELECTION.tsSelectionUIElement, (int)TS_SELECTION_OPTIONS.tsSelFlagDefaultText);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            this.WindowState = FormWindowState.Normal;
            string strID  = null;
            UIElem uiElem = null;

            try
            {
                uiElem = ComFactory.Instance.NewUIElem();
                uiElem.InitializeFromID(tSelInfo.UIElementID, false);
                strID = tSelInfo.UIElementID;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            txtHandle.Text = uiElem.hwnd.ToString("X");
            txtID.Text     = strID;
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            TSelectionInfo tSelInfo = null;

            this.WindowState = FormWindowState.Minimized;
            try
            {
                tSelInfo = (TSelectionInfo)m_tSelection.Start((int)TS_SELECTION.tsSelectionWindow, (int)TS_SELECTION_OPTIONS.tsSelFlagDefaultText);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            UIElem uiElem = null;

            try
            {
                uiElem = ComFactory.Instance.NewUIElem();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            // get the hwnd
            uiElem.hwnd = tSelInfo.WindowHandle;
            string strID = uiElem.GetID(false);

            txtID.Text     = strID;
            txtHandle.Text = uiElem.hwnd.ToString("X");

            int x1, y1, x2, y2;

            try
            {
                // get the rectangle
                uiElem.GetRectangle(out x1, out y1, out x2, out y2);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            // show the points
            txtX.Text        = "0";
            txtY.Text        = "0";
            txtWidth.Text    = (x2 - x1).ToString();
            txtHeight.Text   = (y2 - y1).ToString();
            this.WindowState = FormWindowState.Normal;
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            m_bRegOrWnd = false;

            TSelectionInfo tSelInfo = null;

            this.WindowState = FormWindowState.Minimized;
            System.Threading.Thread.Sleep(100);

            try
            {
                tSelInfo = (TSelectionInfo)m_tSelection.Start(
                    (int)TS_SELECTION.tsSelectionUIElement,
                    (int)TS_SELECTION_OPTIONS.tsSelFlagDefaultText
                    );
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            // get the hwnd
            int hwnd = tSelInfo.WindowHandle;

            txtHandle.Text = hwnd.ToString("X");

            // set the UI element ID
            UIElem uiElem = ComFactory.Instance.NewUIElem();

            if (tSelInfo.UIElementID == "")
            {
                textBox1.Text    = "A valid ID could not be generated!";
                this.WindowState = FormWindowState.Normal;

                return;
            }
            try
            {
                uiElem.InitializeFromID(tSelInfo.UIElementID, true);
                string uiElemID = uiElem.GetID(false);
                textBox1.Text = uiElemID;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            this.WindowState = FormWindowState.Normal;
        }
Пример #5
0
        private void btnCollect_Click(object sender, EventArgs e)
        {
            m_bRegOrWnd      = true;
            this.WindowState = FormWindowState.Minimized;
            System.Threading.Thread.Sleep(100);

            TSelectionInfo tSelInfo = null;

            try
            {
                tSelInfo = (TSelectionInfo)m_tSelection.Start(
                    (int)TS_SELECTION.tsSelectionRectangle,
                    (int)TS_SELECTION_OPTIONS.tsSelFlagDefaultText
                    );
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            // get the hwnd
            int hwnd = tSelInfo.WindowHandle;

            txtHandle.Text = hwnd.ToString("X");

            UIElem uiElem = ComFactory.Instance.NewUIElem();

            uiElem.hwnd = hwnd;

            // set the UI element ID
            textBox1.Text = uiElem.GetID(true);

            // get the selection points
            tSelInfo.GetClientCoordinates();


            // set the points
            txtX.Text      = tSelInfo.RCLeft.ToString();
            txtY.Text      = tSelInfo.RCTop.ToString();
            txtWidth.Text  = tSelInfo.RCWidth.ToString();
            txtHeight.Text = tSelInfo.RCHeight.ToString();

            //PerformRegionCapture(hwnd, x1, y1, width, height);
            this.WindowState = FormWindowState.Normal;
        }
Пример #6
0
        private void btnCollect_Click(object sender, EventArgs e)
        {
            TSelectionInfo tSelInfo = null;

            this.WindowState = FormWindowState.Minimized;
            try
            {
                tSelInfo = (TSelectionInfo)m_tSelection.Start((int)TS_SELECTION.tsSelectionRectangle, (int)TS_SELECTION_OPTIONS.tsSelFlagDefaultText);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            tSelInfo.GetClientCoordinates();

            int    hwnd   = tSelInfo.WindowHandle;
            string strID  = null;
            UIElem uiElem = null;

            try
            {
                uiElem      = ComFactory.Instance.NewUIElem();
                uiElem.hwnd = hwnd;
                strID       = uiElem.GetID(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            txtHandle.Text   = hwnd.ToString("X");
            txtX.Text        = tSelInfo.RCLeft.ToString();
            txtY.Text        = tSelInfo.RCTop.ToString();
            txtWidth.Text    = tSelInfo.RCWidth.ToString();
            txtHeight.Text   = tSelInfo.RCHeight.ToString();
            txtID.Text       = strID;
            this.WindowState = FormWindowState.Normal;
        }
Пример #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            TSelectionInfo tSelInfo = null;

            this.WindowState = FormWindowState.Minimized;
            try
            {
                tSelInfo = (TSelectionInfo)m_tSelection.Start((int)TS_SELECTION.tsSelectionUIElement, (int)TS_SELECTION_OPTIONS.tsSelFlagDefaultText);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            this.WindowState = FormWindowState.Normal;
            string strID = null;

            strID = tSelInfo.UIElementID;

            txtHandle.Text = tSelInfo.WindowHandle.ToString("X");
            txtID.Text     = strID;
        }