private void SaveSettings() { MqttSettings.MqttServer = txtmqttserver.Text; MqttSettings.MqttUsername = txtmqttusername.Text; MqttSettings.MqttPassword = txtmqttpassword.Text; MqttSettings.MqttTopic = txtmqtttopic.Text; MqttSettings.MqttTimerInterval = txtMqttTimerInterval.Text; MqttSettings.ScreenshotEnable = Convert.ToBoolean(chkScreenshot.Checked); MqttSettings.ScreenshotMqtt = Convert.ToBoolean(chkScreenshotMqtt.Checked); MqttSettings.ScreenShotPath = txtScreenshotPath.Text; MqttSettings.MinimizeToTray = chkMinimizeToTray.Checked; MqttSettings.MqttSlideshow = ChkSlideshow.Checked; MqttSettings.MqttSlideshowFolder = txtSlideshowFolder.Text; MqttSettings.CpuSensor = chkCpuSensor.Checked; MqttSettings.FreeMemorySensor = chkMemorySensor.Checked; MqttSettings.VolumeSensor = chkVolumeSensor.Checked; MqttSettings.EnableWebCamPublish = ChkEnableWebCamPublish.Checked; MqttSettings.DiskSensor = (bool)ChkDiskSensor.Checked; MqttSettings.IsComputerUsed = ChkComputerUsed.Checked; MqttSettings.BatterySensor = ChkBatterySensor.Checked; MqttSettings.Monitor = ChkMonitor.Checked; MqttSettings.Toast = chktoast.Checked; MqttSettings.App = ChkProcesses.Checked; MqttSettings.Tts = chkTTS.Checked; MqttSettings.Hibernate = chkHibernate.Checked; MqttSettings.Shutdown = chkShutdown.Checked; MqttSettings.Reboot = chkReboot.Checked; MqttSettings.Suspend = chkSuspend.Checked; MqttSettings.Mute = chkmute.Checked; MqttSettings.Volume = ChkVolume.Checked; if (ChkEnableWebCamPublish.Checked == true) { CmdWebCamTest.Visible = true; } else { CmdWebCamTest.Visible = false; } MqttSettings.EnableTTS = chkTtsEnabled.Checked; if (cmbSpeaker.SelectedItem != null) { MqttSettings.TTSSpeaker = cmbSpeaker.SelectedItem.ToString(); } if (cmbWebcam.SelectedItem != null) { MqttSettings.WebCamToPublish = cmbWebcam.SelectedItem.ToString(); } MqttSettings.Save(); }
public FrmMqttMain(IMqtt mqtt, IMqttPublish mqttPublish, MainFormContainer mainFormContainer) { _mqtt = mqtt; _mqttPublish = mqttPublish; mainFormContainer.MainForm = this; try { InitializeComponent(); Version version = Assembly.GetExecutingAssembly().GetName().Version; toolStripStatusLabel2.Text = ""; MqttSettings.Init(); SetupNotify(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void savesettings() { MqttSettings.MqttServer = txtmqttserver.Text; MqttSettings.MqttUsername = txtmqttusername.Text; MqttSettings.MqttPassword = txtmqttpassword.Text; MqttSettings.MqttTopic = txtmqtttopic.Text; MqttSettings.MqttTimerInterval = txtMqttTimerInterval.Text; MqttSettings.ScreenshotEnable = Convert.ToBoolean(chkScreenshot.Checked); MqttSettings.ScreenshotMqtt = Convert.ToBoolean(chkScreenshotMqtt.Checked); MqttSettings.ScreenShotPath = txtScreenshotPath.Text; MqttSettings.MinimizeToTray = chkMinimizeToTray.Checked; MqttSettings.MqttSlideshow = ChkSlideshow.Checked; MqttSettings.MqttSlideshowFolder = txtSlideshowFolder.Text; MqttSettings.CpuSensor = chkCpuSensor.Checked; MqttSettings.FreeMemorySensor = chkMemorySensor.Checked; MqttSettings.VolumeSensor = chkVolumeSensor.Checked; MqttSettings.EnableWebCamPublish = ChkEnableWebCamPublish.Checked; if (ChkEnableWebCamPublish.Checked == true) { CmdWebCamTest.Visible = true; } else { CmdWebCamTest.Visible = false; } MqttSettings.EnableTTS = chkTtsEnabled.Checked; if (cmbSpeaker.SelectedItem != null) { MqttSettings.TTSSpeaker = cmbSpeaker.SelectedItem.ToString(); } if (cmbWebcam.SelectedItem != null) { MqttSettings.WebCamToPublish = cmbWebcam.SelectedItem.ToString(); } MqttSettings.Save(); }