Exemple #1
0
        private void Frm_DynamicMaskDetails_Load(object sender, EventArgs e)
        {
            Global_GUI.ConfigureFOLV(ref FOLV_MaskHistory, typeof(ObjectPosition), null, null);
            Global_GUI.ConfigureFOLV(ref FOLV_Masks, typeof(ObjectPosition), null, null);

            Refresh();
        }
Exemple #2
0
        private void Refresh()
        {
            //in case of disabled cameras:
            if (comboBox_filter_camera.Text != "All Cameras" && comboBox_filter_camera.Text.Trim().ToLower().Trim() != this.cam.name.Trim().ToLower())
            {
                this.cam = AITOOL.GetCamera(comboBox_filter_camera.Text);
            }

            List <ObjectPosition> hist   = new List <ObjectPosition>();
            List <ObjectPosition> masked = new List <ObjectPosition>();

            if (comboBox_filter_camera.Text == "All Cameras")
            {
                foreach (Camera curcam in AppSettings.Settings.CameraList)
                {
                    hist.AddRange(curcam.maskManager.last_positions_history);
                    masked.AddRange(curcam.maskManager.masked_positions);
                }
            }
            else
            {
                hist   = cam.maskManager.last_positions_history;
                masked = cam.maskManager.masked_positions;
            }

            Global_GUI.UpdateFOLV(ref FOLV_MaskHistory, hist, true);
            Global_GUI.UpdateFOLV(ref FOLV_Masks, masked, true);
            this.CurObjPosLst.Clear();
            ShowMaskImage();
            ShowImageMask(null);
        }
Exemple #3
0
        private void Refresh()
        {
            //in case of disabled cameras:
            if (!string.Equals(this.comboBox_filter_camera.Text, "All Cameras", StringComparison.OrdinalIgnoreCase) && this.comboBox_filter_camera.Text.ToLower().Trim() != this.cam.Name.ToLower().Trim())
            {
                this.cam = AITOOL.GetCamera(this.comboBox_filter_camera.Text);
            }

            List <ObjectPosition> hist   = new List <ObjectPosition>();
            List <ObjectPosition> masked = new List <ObjectPosition>();

            if (this.comboBox_filter_camera.Text == "All Cameras")
            {
                foreach (Camera curcam in AppSettings.Settings.CameraList)
                {
                    hist.AddRange(curcam.maskManager.LastPositionsHistory);
                    masked.AddRange(curcam.maskManager.MaskedPositions);
                }
            }
            else
            {
                hist   = this.cam.maskManager.LastPositionsHistory;
                masked = this.cam.maskManager.MaskedPositions;
            }

            Global_GUI.UpdateFOLV(this.FOLV_MaskHistory, hist, FullRefresh: true);
            Global_GUI.UpdateFOLV(this.FOLV_Masks, masked, FullRefresh: true);
            this.CurObjPosLst.Clear();
            this.ShowMaskImage();
            this.ShowImageMask(null);
        }
Exemple #4
0
        private void FaceSelectionChanged()
        {
            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.
            try
            {
                if (this.FOLV_Faces.SelectedObjects != null && this.FOLV_Faces.SelectedObjects.Count > 0)
                {
                    //set current selected object
                    ClsFace face = (ClsFace)this.FOLV_Faces.SelectedObjects[0];

                    string mainface = Path.Combine(face.FaceStoragePath, $"{face.Name}.jpg");
                    if (File.Exists(mainface))
                    {
                        pictureBoxCurrentFace.BackgroundImage = Image.FromFile(mainface);
                    }
                    else
                    {
                        pictureBoxCurrentFace.BackgroundImage = null;
                    }

                    Global_GUI.UpdateFOLV(FOLV_FaceFiles, face.Files.Values.ToList(), FullRefresh: true);
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                AITOOL.Log($"Error: {ex.Msg()}");
            }
        }
        private void Frm_RelevantObjects_Load(object sender, EventArgs e)
        {
            Loading = true;

            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.


            Global_GUI.ConfigureFOLV(FOLV_RelevantObjects, typeof(ClsRelevantObject));

            this.FOLV_RelevantObjects.BooleanCheckStateGetter = delegate(Object rowObject)
            {
                return(!rowObject.IsNull() && ((ClsRelevantObject)rowObject).Enabled);
            };

            this.FOLV_RelevantObjects.BooleanCheckStatePutter = delegate(Object rowObject, bool newValue)
            {
                if (rowObject.IsNull())
                {
                    return(false);
                }
                ((ClsRelevantObject)rowObject).Enabled = newValue;
                return(newValue);
            };

            this.FillCombo();
            this.SetROM();
            this.LoadROMList();

            Global_GUI.RestoreWindowState(this);

            Loading = false;
        }
        private void LoadROMList()
        {
            //Global_GUI.UpdateFOLV(FOLV_RelevantObjects, this.TempObjectManager.ObjectList, UseSelected: true, SelectObject: this.ro, FullRefresh: true, ForcedSelection: true);
            Global_GUI.UpdateFOLV(FOLV_RelevantObjects, this.TempObjectManager.ObjectList, FullRefresh: true);

            Global_GUI.GroupboxEnableDisable(groupBox1, cb_enabled);
        }
 private void btn_adddefaults_Click(object sender, EventArgs e)
 {
     using var Trace = new Trace();        //This c# 8.0 using feature will auto dispose when the function is done.
     this.TempObjectManager.AddDefaults(); // = new ClsRelevantObjectManager(AppSettings.Settings.ObjectPriority, this.ObjectManager.TypeName, this.ObjectManager.Camera);
     this.ro = null;
     Global_GUI.UpdateFOLV(FOLV_RelevantObjects, this.TempObjectManager.ObjectList, UseSelected: true, SelectObject: this.ro, FullRefresh: true, ForcedSelection: true);
 }
 private void Refresh()
 {
     Global_GUI.UpdateFOLV(ref FOLV_MaskHistory, cam.maskManager.last_positions_history, true);
     Global_GUI.UpdateFOLV(ref FOLV_Masks, cam.maskManager.masked_positions, true);
     this.CurObjPosLst.Clear();
     ShowImageMask(null);
 }
Exemple #9
0
        private void Frm_ImageAdjust_Load(object sender, EventArgs e)
        {
            Global_GUI.RestoreWindowState(this);
            UpdateProfile();

            this.tb_ImageFile.Text = GetBestImage();
        }
Exemple #10
0
        private void Frm_DynamicMaskDetails_Load(object sender, EventArgs e)
        {
            this.loading = true;

            Global_GUI.ConfigureFOLV(this.FOLV_MaskHistory, typeof(ObjectPosition), null, null, "createDate", SortOrder.Descending);
            Global_GUI.ConfigureFOLV(this.FOLV_Masks, typeof(ObjectPosition), null, null, "createDate", SortOrder.Descending);

            Global_GUI.RestoreWindowState(this);

            this.comboBox_filter_camera.Items.Clear();
            this.comboBox_filter_camera.Items.Add("All Cameras");

            int i      = 1;
            int curidx = 1;

            foreach (Camera curcam in AppSettings.Settings.CameraList)
            {
                this.comboBox_filter_camera.Items.Add($"   {curcam.Name}");
                if (this.cam.Name.Trim().ToLower() == curcam.Name.Trim().ToLower())
                {
                    curidx = i;
                    Log($"Cam '{curcam.Name}' is at index '{curidx}'");
                }
                i++;
            }

            this.comboBox_filter_camera.SelectedIndex = curidx;


            this.Refresh();

            this.loading = false;
        }
        private void toolStripButtonDown_Click(object sender, EventArgs e)
        {
            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.

            if (this.ro == null)
            {
                return;
            }

            int idx = this.ObjectList.IndexOf(this.ro);

            if (idx > -1 && idx < this.ObjectList.Count - 1)
            {
                this.ObjectList.Move(idx, idx + 1);

                this.ro = this.ObjectList[idx + 1];

                for (int i = 0; i < this.ObjectList.Count; i++)
                {
                    this.ObjectList[i].Priority = i + 1;
                }

                Global_GUI.UpdateFOLV(FOLV_RelevantObjects, this.ObjectList, UseSelected: true, SelectObject: this.ro, FullRefresh: true, ForcedSelection: true);
            }
        }
        private void Frm_RelevantObjects_Load(object sender, EventArgs e)
        {
            Loading = true;

            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.

            Global_GUI.ConfigureFOLV(FOLV_RelevantObjects, typeof(ClsRelevantObject));

            this.FOLV_RelevantObjects.BooleanCheckStateGetter = delegate(Object rowObject)
            {
                return(((ClsRelevantObject)rowObject).Enabled);
            };

            this.FOLV_RelevantObjects.BooleanCheckStatePutter = delegate(Object rowObject, bool newValue)
            {
                ((ClsRelevantObject)rowObject).Enabled = newValue;
                return(newValue);
            };

            this.ObjectList = ObjectManager.ToList();

            Global_GUI.UpdateFOLV(FOLV_RelevantObjects, this.ObjectList);
            Global_GUI.RestoreWindowState(this);

            Global_GUI.GroupboxEnableDisable(groupBox1, cb_enabled);

            Loading = false;
        }
        private void Frm_Pause_Load(object sender, EventArgs e)
        {
            this.cmb_cameras.Items.Add("All Cameras"); //add all cameras stats entry
            int i           = 0;
            int oldidxstats = 0;

            if (CurrentCam != null)
            {
                foreach (Camera cam in AppSettings.Settings.CameraList)
                {
                    this.cmb_cameras.Items.Add($"   {cam.Name}");
                    if (this.CurrentCam.Name.EqualsIgnoreCase(cam.Name))
                    {
                        oldidxstats = i + 1;
                    }
                    i++;
                }
            }

            if (this.cmb_cameras.Items.Count > 0)
            {
                this.cmb_cameras.SelectedIndex = oldidxstats;
            }

            this.ShowCamera();

            Global_GUI.RestoreWindowState(this);
            //timer1.Start();
        }
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.

            this.ro = this.TempObjectManager.Delete(ro, out int NewIDX);

            Global_GUI.UpdateFOLV(FOLV_RelevantObjects, this.TempObjectManager.ObjectList, UseSelected: true, SelectObject: this.ro, FullRefresh: true, ForcedSelection: true);
        }
        /********************* Start EVENT section*************************************/

        private void Frm_CustomMasking_Load(object sender, EventArgs e)
        {
            Global_GUI.RestoreWindowState(this);

            UpdateRes();

            UpdateMaskFile();
        }
Exemple #16
0
 private void cb_LinkedServers_CheckedChanged(object sender, EventArgs e)
 {
     Global_GUI.GroupboxEnableDisable(groupBoxLinked, cb_LinkedServers);
     if (!cb_LinkedServers.Checked)
     {
         this.CurURL.LinkedResultsServerList = "";
     }
 }
        private void LoadRO([CallerMemberName()] string memberName = null)
        {
            Loading = true;

            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.
            try
            {
                if (this.ro.IsNull())
                {
                    this.cb_enabled.Checked      = false;
                    this.cb_enabled.Enabled      = false;
                    this.tb_Name.Text            = "";
                    this.tb_Time.Text            = "";
                    this.tb_ConfidenceLower.Text = "";
                    this.tb_ConfidenceUpper.Text = "";
                }
                else
                {
                    this.cb_enabled.Checked      = this.ro.Enabled;
                    this.cb_enabled.Enabled      = true;
                    this.tb_Name.Text            = this.ro.Name;
                    this.tb_Time.Text            = this.ro.ActiveTimeRange;
                    this.tb_ConfidenceLower.Text = this.ro.Threshold_lower.ToString();
                    this.tb_ConfidenceUpper.Text = this.ro.Threshold_upper.ToString();

                    if (this.tb_Name.Text.EqualsIgnoreCase("NEW OBJECT") || this.tb_Name.Text.IsEmpty())
                    {
                        this.tb_Name.Enabled = true;
                    }
                    else
                    {
                        this.tb_Name.Enabled = false;
                    }

                    if (this.ro.Trigger)
                    {
                        rb_trigger.Checked = true;
                        rb_ignore.Checked  = false;
                    }
                    else
                    {
                        rb_trigger.Checked = false;
                        rb_ignore.Checked  = true;
                    }
                }

                Global_GUI.GroupboxEnableDisable(groupBox1, cb_enabled);
            }
            catch (Exception ex)
            {
                AITOOL.Log("Error: " + ex.Msg());
            }
            finally
            {
                NeedsSaving = false;
                Loading     = false;
            }
        }
        private void deepstackToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ClsURLItem url = new ClsURLItem("", AppSettings.Settings.AIURLList.Count + 1, URLTypeEnum.DeepStack);

            this.CurURL = url;
            AppSettings.Settings.AIURLList.Add(url);
            Global_GUI.UpdateFOLV(FOLV_AIServers, AppSettings.Settings.AIURLList, UseSelected: true, SelectObject: this.CurURL, FullRefresh: true);
            UpdateButtons();
        }
        private void cb_enabled_CheckedChanged(object sender, EventArgs e)
        {
            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.

            Global_GUI.GroupboxEnableDisable(groupBox1, cb_enabled);

            NeedsSaving = true;

            this.SaveRO();
        }
Exemple #20
0
        private void Frm_Faces_Load(object sender, EventArgs e)
        {
            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.


            Global_GUI.ConfigureFOLV(FOLV_Faces, typeof(ClsFace));
            Global_GUI.ConfigureFOLV(FOLV_FaceFiles, typeof(ClsFaceFile));

            Global_GUI.UpdateFOLV(FOLV_Faces, AITOOL.FaceMan.Faces, FullRefresh: true);

            Global_GUI.RestoreWindowState(this);
        }
        private void toolStripButtonAdd_Click(object sender, EventArgs e)
        {
            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.
            SaveRO();

            ClsRelevantObject ro = new ClsRelevantObject("NEW OBJECT");


            this.ro          = ro;
            this.ro.Priority = this.ObjectList.Count + 1;
            this.ObjectList.Add(ro);
            Global_GUI.UpdateFOLV(FOLV_RelevantObjects, this.ObjectList, UseSelected: true, SelectObject: this.ro, FullRefresh: true, ForcedSelection: true);
        }
 private void toolStripButtonDelete_Click(object sender, EventArgs e)
 {
     if (AppSettings.Settings.AIURLList.Contains(this.CurURL))
     {
         AppSettings.Settings.AIURLList.Remove(this.CurURL);
         for (int i = 0; i < AppSettings.Settings.AIURLList.Count; i++)
         {
             AppSettings.Settings.AIURLList[i].Order = i + 1;
         }
         Global_GUI.UpdateFOLV(FOLV_AIServers, AppSettings.Settings.AIURLList, UseSelected: true, FullRefresh: true);
     }
     UpdateButtons();
 }
 private void Edit()
 {
     using (Frm_AIServerDeepstackEdit frm = new Frm_AIServerDeepstackEdit())
     {
         frm.CurURL = this.CurURL;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             this.CurURL = frm.CurURL;  //this should update the list item by ref - prob not needed but makes me feel warm and fuzzy
             Global_GUI.UpdateFOLV(FOLV_AIServers, AppSettings.Settings.AIURLList, UseSelected: true, SelectObject: this.CurURL, FullRefresh: true);
         }
     }
     UpdateButtons();
 }
        private void toolStripButtonAdd_Click(object sender, EventArgs e)
        {
            using var Trace = new Trace();  //This c# 8.0 using feature will auto dispose when the function is done.
            SaveRO();

            ClsRelevantObject ro = new ClsRelevantObject("NEW OBJECT");

            this.ro = ro;

            if (this.TempObjectManager.TryAdd(ro, true, out int NewIDX))
            {
                Global_GUI.UpdateFOLV(FOLV_RelevantObjects, this.TempObjectManager.ObjectList, UseSelected: true, SelectObject: this.ro, FullRefresh: true, ForcedSelection: true);
            }
        }
Exemple #25
0
        private void Frm_Actions_Load(object sender, EventArgs e)
        {
            try
            {
                Global_GUI.ConfigureFOLV(ref FOLV_Actions, typeof(CameraTriggerAction), null, null);
                Global_GUI.UpdateFOLV(ref FOLV_Actions, actions, true);

                string[] triggertypes = Enum.GetNames(typeof(TriggerType));
                cbType.Items.AddRange(triggertypes);
            }
            catch (Exception ex)
            {
                Global.Log("Error: " + ex.Message);
            }
        }
        /********************* Start EVENT section*************************************/

        private void Frm_CustomMasking_Load(object sender, EventArgs e)
        {
            Global_GUI.RestoreWindowState(this);
            this._maskfilename = AITOOL.GetMaskFile(this.Cam.Name);
            this.Text          = "Custom Masking - " + this._maskfilename;

            if (!File.Exists(this._maskfilename))
            {
                this.Text += " (Missing)";
            }

            this.BrushSize          = this.Cam.mask_brush_size;
            this.numBrushSize.Value = this.Cam.mask_brush_size;
            this.ShowImage();
        }
        private void addDoodsServerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ClsURLItem url = new ClsURLItem("", AppSettings.Settings.AIURLList.Count + 1, URLTypeEnum.DOODS);

            if (!AppSettings.Settings.AIURLList.Contains(url))
            {
                this.CurURL = url;
                AppSettings.Settings.AIURLList.Add(url);
                Global_GUI.UpdateFOLV(FOLV_AIServers, AppSettings.Settings.AIURLList, UseSelected: true, SelectObject: this.CurURL, FullRefresh: true);
            }
            else
            {
                MessageBox.Show("Already exists");
            }
            UpdateButtons();
        }
Exemple #28
0
        private void Frm_Errors_Load(object sender, EventArgs e)
        {
            Global_GUI.RestoreWindowState(this);

            this.Show();

            try
            {
                Global_GUI.ConfigureFOLV(this.folv_errors, typeof(ClsLogItm), null, null, "Time", SortOrder.Descending);

                Global_GUI.UpdateFOLV(this.folv_errors, this.errors);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #29
0
        private void Frm_ObjectDetail_Load(object sender, EventArgs e)
        {
            Global_GUI.RestoreWindowState(this);

            this.Show();

            try
            {
                Global_GUI.ConfigureFOLV(this.folv_ObjectDetail, typeof(ClsPrediction), null, null);

                Global_GUI.UpdateFOLV(this.folv_ObjectDetail, this.PredictionObjectDetail);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static void UpdateFOLV_add(FastObjectListView olv, ICollection Collection, bool ResizeCols = false, bool Follow = false)
        {
            Global_GUI.InvokeIFRequired(olv, () =>
            {
                try
                {
                    if (olv.Items.Count == 0)
                    {
                        olv.EmptyListMsg = "Loading...";
                    }

                    olv.Freeze();

                    olv.UpdateObjects(Collection);

                    if (olv.Items.Count > 0)
                    {
                        if (Follow)
                        {
                            olv.SelectedIndex = 0;                              //olv.Items.Count - 1;
                            olv.EnsureModelVisible(olv.SelectedObject);
                        }

                        //update column size only if did not restore folv state file or forced
                        if (olv.Tag == null || ResizeCols)
                        {
                            olv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                            olv.Tag = "resizedcols";
                        }
                    }
                    else
                    {
                        olv.EmptyListMsg = "Empty";
                    }
                }
                catch (Exception ex)
                {
                    Global.Log("Error: " + Global.ExMsg(ex));
                }
                finally
                {
                    olv.Unfreeze();
                }
            });
        }