/// <summary>
        /// Enums the windows.
        /// </summary>
        /// <param name="hWnd">The h WND.</param>
        /// <param name="lParam">The l parameter.</param>
        /// <returns></returns>
        protected bool EnumWindows(IntPtr hWnd, IntPtr lParam)
        {
            int size = GetWindowTextLength(hWnd);

            if (size++ > 0 && IsWindowVisible(hWnd))
            {
                StringBuilder sb = new StringBuilder(size);
                GetWindowText(hWnd, sb, size);

                CaptureSettings captureSettings = new CaptureSettings
                {
                    m_Adapter = 0,
                    m_Output  = 0
                };

                RECT rct;

                GetWindowRect(hWnd, out rct);

                captureSettings.m_Rect = new DsRect(rct.Left, rct.Top, rct.Right, rct.Bottom);

                CaptureItem captureItem = new CaptureItem(sb.ToString(), captureSettings);

                captureMethodCombo.Items.Add(captureItem);
            }

            return(true);
        }
Exemplo n.º 2
0
        static CaptureItem GetCaptureItemFromRow(Event e, DataRow row)
        {
            CaptureItem result = null;

            string adr = row["address"].ToString();

            if (adr.Contains("Capture"))
            {
                string node = DataTable_Functions.TrakHound.GetLastNode(row);
                if (node.ToLower() == "item")
                {
                    string strId = DataTable_Functions.TrakHound.GetRowAttribute("id", row);
                    int    id;
                    if (int.TryParse(strId, out id))
                    {
                        result      = new CaptureItem();
                        result.id   = id;
                        result.name = DataTable_Functions.TrakHound.GetRowAttribute("name", row);
                        result.link = DataTable_Functions.TrakHound.GetRowAttribute("link", row);
                    }
                }
            }

            return(result);
        }
Exemplo n.º 3
0
        void SaveCaptureItems(CaptureItem ci, Event e, DataTable dt)
        {
            string adr = "/GeneratedData/GeneratedEvents/Event||" + e.id.ToString("00") + "/Capture/Item";
            int    id  = DataTable_Functions.TrakHound.GetUnusedAddressId(adr, dt);

            adr = adr + "||" + id.ToString("00");

            ci.id = id;

            // Save Root
            string attr = "";

            attr += "id||" + ci.id.ToString("00") + ";";
            attr += "name||" + ci.name.Replace(' ', '_').ToLower() + ";";

            string link = ci.link;
            List <CollectedItem> linkitems = CollectedItems.ToList();
            CollectedItem        dataitem  = linkitems.Find(x => x.Display == link);

            if (dataitem != null)
            {
                link = dataitem.Id;
            }

            attr += "link||" + link + ";";
            DataTable_Functions.UpdateTableValue(dt, "address", adr, "attributes", attr);
        }
        /// <summary>
        /// Initializes the capture monitors.
        /// </summary>
        private void InitializeCaptureMonitors()
        {
            var factory = new Factory1();

            for (int i = 0; i < factory.GetAdapterCount(); i++)
            {
                for (int j = 0; j < factory.GetAdapter(i).GetOutputCount(); j++)
                {
                    var output = factory.GetAdapter(i).GetOutput(j);

                    CaptureSettings settings = new CaptureSettings();
                    settings.m_Adapter = i;
                    settings.m_Output  = j;
                    settings.m_Rect    = new DsRect(
                        output.Description.DesktopBounds.Left,
                        output.Description.DesktopBounds.Top,
                        output.Description.DesktopBounds.Right,
                        output.Description.DesktopBounds.Bottom
                        );

                    CaptureItem captureItem = new CaptureItem(output.Description.DeviceName, settings);
                    captureMethodCombo.Items.Add(captureItem);
                }
            }
        }
Exemplo n.º 5
0
        void Event_AddCaptureItemClicked(Controls.Event e)
        {
            CaptureItem ci = new CaptureItem();

            if (e.ParentEvent != null)
            {
                Controls.CaptureItem item = CreateCaptureItem(ci, e.ParentEvent);
                e.ParentEvent.captureItems.Add(ci);
                e.CaptureItems.Add(item);
            }

            SettingChanged?.Invoke(null, null, null);
        }
        /// <summary>
        /// Called when [apply changes].
        /// </summary>
        /// <returns></returns>
        public override HRESULT OnApplyChanges()
        {
            if (m_FilterSettings != null && captureMethodCombo.SelectedItem != null)
            {
                CaptureItem setting = (captureMethodCombo.SelectedItem as CaptureItem);
                if (setting != null)
                {
                    Dirty = false;

                    return(m_FilterSettings.ChangeCaptureSettings(setting.m_CaptureSettings));
                }
            }

            return(HRESULT.NOERROR);
        }
        private void GetCaptureItems(string Id)
        {
            GeneratedEventCaptureItems.Clear();

            if (ParentPage != null && ParentPage.GeneratedEventItems != null)
            {
                var e = ParentPage.GeneratedEventItems.ToList().Find(x => x.Id == Id);
                if (e != null)
                {
                    // Add each Value
                    foreach (var item in e.Event.captureItems)
                    {
                        var i = new CaptureItem(item);
                        GeneratedEventCaptureItems.Add(i);
                    }
                }
            }
        }
Exemplo n.º 8
0
        Controls.CaptureItem CreateCaptureItem(CaptureItem ci, Event e)
        {
            Controls.CaptureItem result = new Controls.CaptureItem();

            result.ParentPage        = this;
            result.ParentEvent       = e;
            result.ParentCaptureItem = ci;

            result.SettingChanged += CaptureItem_SettingChanged;
            result.RemoveClicked  += CaptureItem_RemoveClicked;

            if (ci.name != null)
            {
                result.CaptureName = String_Functions.UppercaseFirst(ci.name.Replace('_', ' '));
            }

            result.link_COMBO.Text = ci.link;

            return(result);
        }
Exemplo n.º 9
0
        void SaveCaptureItems(CaptureItem ci, Event e, DataTable dt)
        {
            string adr = "/GeneratedData/GeneratedEvents/Event||" + e.id.ToString("00") + "/Capture/Item";
            int id = DataTable_Functions.TrakHound.GetUnusedAddressId(adr, dt);
            adr = adr + "||" + id.ToString("00");

            ci.id = id;

            // Save Root
            string attr = "";
            attr += "id||" + ci.id.ToString("00") + ";";
            attr += "name||" + ci.name.Replace(' ', '_').ToLower() + ";";

            string link = ci.link;
            List<CollectedItem> linkitems = CollectedItems.ToList();
            CollectedItem dataitem = linkitems.Find(x => x.Display == link);
            if (dataitem != null) link = dataitem.Id;

            attr += "link||" + link + ";";
            DataTable_Functions.UpdateTableValue(dt, "address", adr, "attributes", attr);
        }
Exemplo n.º 10
0
        void Event_AddCaptureItemClicked(Controls.Event e)
        {
            CaptureItem ci = new CaptureItem();

            if (e.ParentEvent != null)
            {
                Controls.CaptureItem item = CreateCaptureItem(ci, e.ParentEvent);
                e.ParentEvent.captureItems.Add(ci);
                e.CaptureItems.Add(item);
            }

            SettingChanged?.Invoke(null, null, null);
        }
Exemplo n.º 11
0
        Controls.CaptureItem CreateCaptureItem(CaptureItem ci, Event e)
        {
            Controls.CaptureItem result = new Controls.CaptureItem();

            result.ParentPage = this;
            result.ParentEvent = e;
            result.ParentCaptureItem = ci;

            result.SettingChanged += CaptureItem_SettingChanged;
            result.RemoveClicked += CaptureItem_RemoveClicked;

            if (ci.name != null)
            {
                result.CaptureName = String_Functions.UppercaseFirst(ci.name.Replace('_', ' '));
            }

            result.link_COMBO.Text = ci.link;

            return result;
        }
Exemplo n.º 12
0
        static CaptureItem GetCaptureItemFromRow(Event e, DataRow row)
        {
            CaptureItem result = null;

            string adr = row["address"].ToString();

            if (adr.Contains("Capture"))
            {
                string node = DataTable_Functions.TrakHound.GetLastNode(row);
                if (node.ToLower() == "item")
                {
                    string strId = DataTable_Functions.TrakHound.GetRowAttribute("id", row);
                    int id;
                    if (int.TryParse(strId, out id))
                    {
                        result = new CaptureItem();
                        result.id = id;
                        result.name = DataTable_Functions.TrakHound.GetRowAttribute("name", row);
                        result.link = DataTable_Functions.TrakHound.GetRowAttribute("link", row);
                    }
                }
            }

            return result;
        }
Exemplo n.º 13
0
        public static List <Event> GetGeneratedEvents(DataTable dt)
        {
            var result = new List <Event>();

            var      table   = UpdateTable(dt);
            string   address = "/GeneratedEvents/";
            string   filter  = "address LIKE '" + address + "*'";
            DataView dv      = table.AsDataView();

            dv.RowFilter = filter;
            DataTable temp_dt = dv.ToTable();

            temp_dt.PrimaryKey = new DataColumn[] { temp_dt.Columns["address"] };

            // Get Events
            foreach (DataRow row in temp_dt.Rows)
            {
                Event e = GetEventFromRow(result, row);
                if (e != null)
                {
                    result.Add(e);
                }
            }

            // Get Values
            foreach (Event e in result)
            {
                string eventfilter = "address LIKE '" + address + "Event||" + e.id.ToString("00") + "/";
                dv                 = table.AsDataView();
                dv.RowFilter       = eventfilter + "*'";
                temp_dt            = dv.ToTable();
                temp_dt.PrimaryKey = new DataColumn[] { temp_dt.Columns["address"] };

                foreach (DataRow row in temp_dt.Rows)
                {
                    Value v = GetValueFromRow(e, row);
                    if (v != null)
                    {
                        e.values.Add(v);
                    }

                    GetDefaultFromRow(e, row);

                    // Get Capture Items
                    CaptureItem ci = GetCaptureItemFromRow(e, row);
                    if (ci != null)
                    {
                        e.captureItems.Add(ci);
                    }
                }

                foreach (Value v in e.values)
                {
                    filter             = eventfilter + "Value||" + v.id.ToString("00") + "/" + "*'";
                    dv                 = table.AsDataView();
                    dv.RowFilter       = filter;
                    temp_dt            = dv.ToTable();
                    temp_dt.PrimaryKey = new DataColumn[] { temp_dt.Columns["address"] };

                    foreach (DataRow row in temp_dt.Rows)
                    {
                        Trigger t = GetTriggerFromRow(v, row);
                        if (t != null)
                        {
                            var match = GetMultiTriggerFromRow(v, row);
                            if (match != null)
                            {
                                MultiTrigger multiTrigger = v.triggers.OfType <MultiTrigger>().ToList().Find(x => x.id == match.id);
                                if (multiTrigger != null)
                                {
                                    multiTrigger.triggers.Add(t);
                                }
                            }
                            else
                            {
                                v.triggers.Add(t);
                            }
                        }

                        MultiTrigger mt = GetMultiTriggerFromRow(v, row);
                        if (mt != null)
                        {
                            MultiTrigger multiTrigger = v.triggers.OfType <MultiTrigger>().ToList().Find(x => x.id == mt.id);
                            if (multiTrigger == null)
                            {
                                v.triggers.Add(mt);
                            }
                        }

                        GetResultFromRow(v, row);
                    }
                }
            }

            return(result);
        }
        private void GetCaptureItems(string Id)
        {
            GeneratedEventCaptureItems.Clear();

            if (ParentPage != null && ParentPage.GeneratedEventItems != null)
            {
                var e = ParentPage.GeneratedEventItems.ToList().Find(x => x.Id == Id);
                if (e != null)
                {
                    // Add each Value
                    foreach (var item in e.Event.captureItems)
                    {
                        var i = new CaptureItem(item);
                        GeneratedEventCaptureItems.Add(i);
                    }
                }
            }
        }