예제 #1
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   = tb_MQTT_Topic.Text.Trim();
                frm.tb_Payload.Text = 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.Save();
                }
            }
        }
 private void removeMaskToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (contextMenuPosObj != null)
     {
         cam.maskManager.masked_positions.Remove(contextMenuPosObj);
         contextMenuPosObj = null;
         Refresh();
         AppSettings.Save();
     }
 }
 private void createStaticMaskToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (contextMenuPosObj != null)
     {
         contextMenuPosObj.isStatic = true;
         contextMenuPosObj.counter  = 0;
         contextMenuPosObj          = null;
         Refresh();
         AppSettings.Save();
     }
 }
 private void createStaticMaskToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (contextMenuPosObj != null)
     {
         contextMenuPosObj.isStatic = true;
         contextMenuPosObj.counter  = 0;
         cam.maskManager.masked_positions.Add(contextMenuPosObj);
         cam.maskManager.last_positions_history.Remove(contextMenuPosObj);
         contextMenuPosObj = null;
         Refresh();
         AppSettings.Save();
     }
 }
예제 #5
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();
                }
            }
        }
 private void lblClearHistory_Click(object sender, EventArgs e)
 {
     cam.maskManager.last_positions_history.Clear();
     Refresh();
     AppSettings.Save();
 }
 private void lblClearMasks_Click(object sender, EventArgs e)
 {
     cam.maskManager.masked_positions.Clear();
     Refresh();
     AppSettings.Save();
 }
예제 #8
0
 //one alarm that contained irrelevant objects counter
 public void IncrementIrrelevantAlerts()
 {
     stats_irrelevant_alerts++;
     AppSettings.Save();
     //WriteConfig(name, prefix, triggering_objects_as_string, trigger_urls_as_string, telegram_enabled, enabled, cooldown_time, threshold_lower, threshold_upper);
 }