Пример #1
0
        private void BtnDynamicMaskingSettings_Click(object sender, EventArgs e)
        {
            using (Frm_DynamicMasking frm = new Frm_DynamicMasking())
            {
                frm.cam  = this.cam;
                frm.Text = "Dynamic Masking Settings - " + this.cam.Name;

                //Camera cam = AITOOL.GetCamera(list2.SelectedItems[0].Text);

                //Merge ClassObject's code
                frm.num_history_mins.Value = this.cam.maskManager.HistorySaveMins;       //load minutes to retain history objects that have yet to become masks
                frm.num_mask_create.Value  = this.cam.maskManager.HistoryThresholdCount; // load mask create counter
                frm.num_mask_remove.Value  = this.cam.maskManager.MaskRemoveMins;        //load mask remove counter
                frm.numMaskThreshold.Value = this.cam.maskManager.MaskRemoveThreshold;
                frm.num_max_unused.Value   = this.cam.maskManager.MaxMaskUnusedDays;

                //frm.num_percent_var.Value = (decimal)cam.maskManager.thresholdPercent * 100;
                frm.num_percent_var.Value = (decimal)this.cam.maskManager.PercentMatch;

                frm.cb_enabled.Checked = this.cam.maskManager.MaskingEnabled;

                frm.tb_objects.Text = this.cam.maskManager.Objects;

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    ////get masking values from textboxes
                    Int32.TryParse(frm.num_history_mins.Text, out int history_mins);
                    Int32.TryParse(frm.num_mask_create.Text, out int mask_create_counter);
                    Int32.TryParse(frm.num_mask_remove.Text, out int mask_remove_mins);
                    Int32.TryParse(frm.numMaskThreshold.Text, out int maskRemoveThreshold);
                    Int32.TryParse(frm.num_percent_var.Text, out int percent_match);
                    Int32.TryParse(frm.num_max_unused.Text, out int unused);

                    ////convert to percent
                    //Double percent_variance = (double)variance / 100;

                    this.cam.maskManager.HistorySaveMins       = history_mins;
                    this.cam.maskManager.HistoryThresholdCount = mask_create_counter;
                    this.cam.maskManager.MaskRemoveMins        = mask_remove_mins;
                    this.cam.maskManager.MaskRemoveThreshold   = maskRemoveThreshold;
                    this.cam.maskManager.PercentMatch          = percent_match;
                    this.cam.maskManager.MaxMaskUnusedDays     = unused;

                    this.cam.maskManager.Objects = frm.tb_objects.Text.Trim();

                    this.cam.maskManager.MaskingEnabled = frm.cb_enabled.Checked;

                    AppSettings.SaveAsync();
                }
            }
        }
Пример #2
0
        private void BtnDynamicMaskingSettings_Click(object sender, EventArgs e)
        {
            using (Frm_DynamicMasking frm = new Frm_DynamicMasking())
            {
                frm.Text = "Dynamic Masking Settings - " + cam.name;

                //Camera cam = AITOOL.GetCamera(list2.SelectedItems[0].Text);

                //Merge ClassObject's code
                frm.num_history_mins.Value = cam.maskManager.history_save_mins;       //load minutes to retain history objects that have yet to become masks
                frm.num_mask_create.Value  = cam.maskManager.history_threshold_count; // load mask create counter
                frm.num_mask_remove.Value  = cam.maskManager.mask_remove_mins;        //load mask remove counter
                //frm.num_percent_var.Value = (decimal)cam.maskManager.thresholdPercent * 100;
                frm.num_percent_var.Value = (decimal)cam.maskManager.thresholdPercent;

                frm.cb_enabled.Checked = cam.maskManager.masking_enabled;

                frm.tb_objects.Text = cam.maskManager.objects;

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    ////get masking values from textboxes


                    Int32.TryParse(frm.num_history_mins.Text, out int history_mins);
                    Int32.TryParse(frm.num_mask_create.Text, out int mask_create_counter);
                    Int32.TryParse(frm.num_mask_remove.Text, out int mask_remove_mins);
                    Int32.TryParse(frm.num_percent_var.Text, out int variance);

                    ////convert to percent
                    //Double percent_variance = (double)variance / 100;

                    cam.maskManager.history_save_mins       = history_mins;
                    cam.maskManager.history_threshold_count = mask_create_counter;
                    cam.maskManager.mask_remove_mins        = mask_remove_mins;
                    cam.maskManager.thresholdPercent        = variance;
                    cam.maskManager.objects = frm.tb_objects.Text.Trim();

                    cam.maskManager.masking_enabled = frm.cb_enabled.Checked;

                    AppSettings.Save();
                }
            }
        }