private void btnAdvanced_Click(object sender, EventArgs e)
        {
            using (Frm_DynamicMaskingAdvanced frm = new Frm_DynamicMaskingAdvanced())
            {
                frm.cbEnableScaling.Checked  = this.cam.maskManager.ScaleConfig.IsScaledObject;
                frm.numSmallObjMax.Value     = this.cam.maskManager.ScaleConfig.SmallObjectMaxPercent;
                frm.numSmallObjPercent.Value = this.cam.maskManager.ScaleConfig.SmallObjectMatchPercent;
                frm.numMidObjMin.Value       = this.cam.maskManager.ScaleConfig.MediumObjectMinPercent;
                frm.numMidObjMax.Value       = this.cam.maskManager.ScaleConfig.MediumObjectMaxPercent;
                frm.numMidObjPercent.Value   = this.cam.maskManager.ScaleConfig.MediumObjectMatchPercent;

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    Int32.TryParse(frm.numSmallObjMax.Text, out int smallObjMax);
                    Int32.TryParse(frm.numSmallObjPercent.Text, out int smallObjPercent);
                    Int32.TryParse(frm.numMidObjMin.Text, out int midObjMin);
                    Int32.TryParse(frm.numMidObjMax.Text, out int midObjMax);
                    Int32.TryParse(frm.numMidObjPercent.Text, out int midObjPercent);

                    this.cam.maskManager.ScaleConfig.IsScaledObject = frm.cbEnableScaling.Checked;

                    this.cam.maskManager.ScaleConfig.SmallObjectMaxPercent    = smallObjMax;
                    this.cam.maskManager.ScaleConfig.SmallObjectMatchPercent  = smallObjPercent;
                    this.cam.maskManager.ScaleConfig.MediumObjectMinPercent   = midObjMin;
                    this.cam.maskManager.ScaleConfig.MediumObjectMaxPercent   = midObjMax;
                    this.cam.maskManager.ScaleConfig.MediumObjectMatchPercent = midObjPercent;

                    AppSettings.SaveAsync(true);
                }
            }
        }
Exemplo n.º 2
0
        private void linkLabelMqttSettings_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            using (Frm_MQTTSettings frm = new Frm_MQTTSettings())
            {
                frm.cam = this.cam;

                frm.tb_ServerPort.Text = AppSettings.Settings.mqtt_serverandport;
                frm.cb_UseTLS.Checked  = AppSettings.Settings.mqtt_UseTLS;
                frm.tb_Password.Text   = AppSettings.Settings.mqtt_password;
                frm.tb_Username.Text   = AppSettings.Settings.mqtt_username;

                frm.tb_Topic.Text   = this.tb_MQTT_Topic.Text.Trim();
                frm.tb_Payload.Text = this.tb_MQTT_Payload.Text.Trim();

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    AppSettings.Settings.mqtt_UseTLS        = frm.cb_UseTLS.Checked;
                    AppSettings.Settings.mqtt_username      = frm.tb_Username.Text.Trim();
                    AppSettings.Settings.mqtt_serverandport = frm.tb_ServerPort.Text.Trim();
                    AppSettings.Settings.mqtt_password      = frm.tb_Password.Text.Trim();

                    this.tb_MQTT_Payload.Text = frm.tb_Payload.Text.Trim();
                    this.tb_MQTT_Topic.Text   = frm.tb_Topic.Text.Trim();


                    AppSettings.SaveAsync();
                }
            }
        }
Exemplo n.º 3
0
 private void bt_Save_Click(object sender, EventArgs e)
 {
     this.UpdateURL();
     AITOOL.UpdateAIURLs();
     AppSettings.SaveAsync();
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Exemplo n.º 4
0
 private void removeHistoryMaskToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (ObjectPosition op in this.CurObjPosLst)
     {
         this.cam.maskManager.RemoveHistoryMask(op);
     }
     this.Refresh();
     AppSettings.SaveAsync();
 }
Exemplo n.º 5
0
 private void createDynamicMaskTemporaryToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (ObjectPosition op in this.CurObjPosLst)
     {
         this.cam.maskManager.CreateDynamicMask(op, false, true);
     }
     this.Refresh();
     AppSettings.SaveAsync();
 }
Exemplo n.º 6
0
 private void createStaticMaskToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     foreach (ObjectPosition op in this.CurObjPosLst)
     {
         op.IsStatic = true;
         op.Counter  = 0;
     }
     this.Refresh();
     AppSettings.SaveAsync();
 }
Exemplo n.º 7
0
 private void createStaticMaskToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (ObjectPosition op in this.CurObjPosLst)
     {
         op.IsStatic = true;
         op.Counter  = 0;
         this.cam.maskManager.CreateDynamicMask(op, true);
     }
     this.Refresh();
     AppSettings.SaveAsync(true);
 }
Exemplo n.º 8
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();
                }
            }
        }
        private void linkLabelMqttSettings_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            using (Frm_MQTTSettings frm = new Frm_MQTTSettings())
            {
                frm.cam = this.cam;

                frm.tb_ServerPort.Text = AppSettings.Settings.mqtt_serverandport;
                frm.cb_UseTLS.Checked  = AppSettings.Settings.mqtt_UseTLS;
                frm.tb_Password.Text   = AppSettings.Settings.mqtt_password;
                frm.tb_Username.Text   = AppSettings.Settings.mqtt_username;
                frm.tb_ClientID.Text   = AppSettings.Settings.mqtt_clientid;

                frm.tb_LWTTopic.Text   = AppSettings.Settings.mqtt_LastWillTopic;
                frm.tb_LWTPayload.Text = AppSettings.Settings.mqtt_LastWillPayload;

                frm.tb_Topic.Text   = this.tb_MQTT_Topic.Text.Trim();
                frm.tb_Payload.Text = this.tb_MQTT_Payload.Text.Trim();

                frm.cb_Retain.Checked = this.cam.Action_mqtt_retain_message;

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    AppSettings.Settings.mqtt_UseTLS        = frm.cb_UseTLS.Checked;
                    AppSettings.Settings.mqtt_username      = frm.tb_Username.Text.Trim();
                    AppSettings.Settings.mqtt_serverandport = frm.tb_ServerPort.Text.Trim();
                    AppSettings.Settings.mqtt_password      = frm.tb_Password.Text.Trim();
                    AppSettings.Settings.mqtt_clientid      = frm.tb_ClientID.Text.Trim();

                    AppSettings.Settings.mqtt_LastWillTopic   = frm.tb_LWTTopic.Text.Trim();
                    AppSettings.Settings.mqtt_LastWillPayload = frm.tb_LWTPayload.Text.Trim();

                    this.tb_MQTT_Payload.Text = frm.tb_Payload.Text.Trim();
                    this.tb_MQTT_Topic.Text   = frm.tb_Topic.Text.Trim();

                    this.cam.Action_mqtt_retain_message = frm.cb_Retain.Checked;

                    AppSettings.SaveAsync();
                }
            }
        }
Exemplo n.º 10
0
 private void lblClearHistory_Click(object sender, EventArgs e)
 {
     this.cam.maskManager.LastPositionsHistory.Clear();
     this.Refresh();
     AppSettings.SaveAsync();
 }
Exemplo n.º 11
0
 private void lblClearMasks_Click(object sender, EventArgs e)
 {
     this.cam.maskManager.MaskedPositions.Clear();
     this.Refresh();
     AppSettings.SaveAsync();
 }
Exemplo n.º 12
0
 //one alarm that contained irrelevant objects counter
 public void IncrementIrrelevantAlerts()
 {
     this.stats_irrelevant_alerts++;
     AppSettings.SaveAsync();
     //WriteConfig(name, prefix, triggering_objects_as_string, trigger_urls_as_string, telegram_enabled, enabled, cooldown_time, threshold_lower, threshold_upper);
 }