Exemple #1
0
 public LightPanel()
 {
     InitializeComponent();
     GlobalSettings.InitThemeAndLang(Controls, this);
     GetLightData();
     contentInitialized = true;
 }
 public OtherSensorsPanel()
 {
     InitializeComponent();
     GlobalSettings.InitThemeAndLang(Controls, this);
     Column1.HeaderText = Languages.GetLocalizedString("DateText", "Date");
     Column2.HeaderText = Languages.GetLocalizedString("Name", "Sensor Name");
     Column3.HeaderText = Languages.GetLocalizedString("Value", "Value");
     toolTip1.SetToolTip(button2, Languages.GetLocalizedString("ExportToXls", "Export to Excel-spreadsheet"));
     toolTip2.SetToolTip(button3, Languages.GetLocalizedString("MainSensorsToolTip1", "Show main sensors"));
     GetSensorsValuesAndUpdate(DateTime.Now);
 }
 public ChoosePanel(Form callingForm = null)
 {
     InitializeComponent();
     GlobalSettings.InitThemeAndLang(Controls, this);
     comboBox1.Items.AddRange(new string[5] {
         Languages.GetLocalizedString("PanelName0", "Main Control Panel"),
         Languages.GetLocalizedString("PanelName1", "Light Control Panel"),
         Languages.GetLocalizedString("PanelName2", "Custom sensors Panel"),
         Languages.GetLocalizedString("PanelName3", "Settings Panel"),
         Languages.GetLocalizedString("PanelName4", "About Program Panel")
     });
     f = callingForm;
 }
        private void ApplyNewSettings(bool replacePanelToHome = true)
        {
            GlobalSettings.ChangeSettings(

                (comboBox1.SelectedItem != null) ? comboBox1.Text.ToString() : Languages.curlang,

                GlobalSettings.ThemeStringToColor(comboBox2.SelectedItem),

                (comboBox2.SelectedItem != null) ? (
                    (comboBox2.SelectedItem.ToString() == "Light")  ? Color.FromName("ControlText")     :
                    (comboBox2.SelectedItem.ToString() == "Dark")   ? Color.FromName("HighlightText")   :
                    (comboBox2.SelectedItem.ToString() == "Green")  ? Color.FromName("ControlText")     :
                    (comboBox2.SelectedItem.ToString() == "Cyan")   ? Color.FromName("HighlightText")   :
                    (comboBox2.SelectedItem.ToString() == "Pink")   ? Color.FromName("ControlText")     :
                    (comboBox2.SelectedItem.ToString() == "Orange") ? Color.FromName("HighlightText")   :
                    (comboBox2.SelectedItem.ToString() == "Maroon") ? Color.FromName("HighlightText")   :
                    Color.FromName("ControlText")) : GlobalSettings.fontcol,

                checkBox1.Checked, checkBox2.Checked, checkBox3.Checked
                );

            if (startForm == null)
            {
                DialogResult settingsWarningResult = MessageBox.Show(
                    Languages.GetLocalizedString(
                        "SettingsWarningLine1", "To completely change the theme and language"
                        ) + "\n" +
                    Languages.GetLocalizedString("SettingsWarningLine2", "click in this message OK, then") + "\n" +
                    Languages.GetLocalizedString(
                        "SeetingsWarningLine3", "the application will be restarted automatically"
                        ),
                    Languages.GetLocalizedString("ChangingSettingsHeading", "Changing Settings"),
                    MessageBoxButtons.OKCancel, MessageBoxIcon.Warning
                    );
                if (settingsWarningResult == DialogResult.OK)
                {
                    Application.Restart();
                }
            }
            else
            {
                GlobalSettings.InitThemeAndLang(startForm.Controls, startForm);
            }

            if (replacePanelToHome)
            {
                MainForm.GoBackPage(this);
            }
        }
        public SettingsForm(Form _startForm = null)
        {
            InitializeComponent();
            this.BackColor = GlobalSettings.theme;
            GlobalSettings.InitThemeAndLang(Controls, this);

            System.Collections.Generic.Dictionary <string, string> langFiles = Languages.InitLangs();
            comboBox1.Items.Clear();
            foreach (string key in langFiles.Keys)
            {
                comboBox1.Items.Add(key);
            }

            comboBox1.SelectedItem = Languages.curlang;
            comboBox2.SelectedItem = GlobalSettings.ColorToThemeName(GlobalSettings.theme);
            checkBox1.Checked      = GlobalSettings.minimizeToTray;
            checkBox2.Checked      = GlobalSettings.dontWorkInBackground;
            checkBox3.Checked      = GlobalSettings.autoUpdateSensorsVals;

            startForm = _startForm;
        }
        public ControlPanel()
        {
            InitializeComponent();
            GlobalSettings.InitThemeAndLang(Controls, this);

            sensorsToolTips = new ToolTip[6];
            for (int i = 0; i < 6; i++)
            {
                sensorsToolTips[i] = new ToolTip();
            }

            foreach (ToolTip tt in sensorsToolTips)
            {
                tt.ToolTipTitle =
                    sensorsToolTips[0].ToolTipTitle = Languages.GetLocalizedString("LastUpdate", "Last Update: ");
                tt.IsBalloon = true;
            }

            sensorsText = new string[6] {
                label1.Text, label2.Text, label5.Text, linkLabel1.Text, label3.Text, ""
            };
            GetSensorsValuesAndUpdate(DateTime.Now);
        }
Exemple #7
0
        public MainForm()
        {
            InitializeComponent();

            Logging.DeleteLogFile();

            #region Checking configuration files
            foreach (string impfile in importantFiles)
            {
                if (!File.Exists(impfile))
                {
                    Logging.LogEvent(2, "ConfFilesCheck", $"File {impfile} not found!");
                    ExtractFiles();
                    break;
                }
            }
            #endregion

            #region Connecting to DB
            DatabaseConnecting.ReadDefaultDbParams();
            if (!DatabaseConnecting.ConnectToDb())
            {
                MessageBox.Show(
                    "An error happened while connecting to database! Application will be closed.", "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Error
                    );
                Close();
            }
            ;
            #endregion

            Accounts.LoadCredentials();

            #region Receiving "last update" value
            List <object> lastUpdateResult = DatabaseConnecting.ProcessSqlRequest(
                "SELECT valdatetime FROM `other_sensors` WHERE id = 0 LIMIT 1"
                );
            if (lastUpdateResult.Count < 1)
            {
                Logging.LogEvent(
                    4, "BackgroundMonitor",
                    "The server did not return last update field! Timer will be disabled."
                    );
                notifyIcon1.ShowBalloonTip(
                    2000, "AchSmartHome",
                    Languages.GetLocalizedString(
                        "GetUpdateResultError",
                        "The server did not return the critical system value \"last update\"! " +
                        "Background process will be terminated."
                        ),
                    ToolTipIcon.Error);
                timer1.Enabled = false;
                timer1.Stop();
            }
            lastUpdateDt = DateTime.Parse(lastUpdateResult[0].ToString());
            #endregion

            GlobalSettings.InitThemeAndLang(Controls, this);
            saveFileDialog1.Title = Languages.GetLocalizedString("ChooseLogDest", "Choose Log-file Copying Destination");

            panel1               = new Panel();
            panel1.Name          = "panel1";
            panel1.Location      = new System.Drawing.Point(12, 51);
            panel1.AutoSize      = true;
            panel1.ControlAdded += new ControlEventHandler(PanelChanged);
            Controls.Add(panel1);

            while (Accounts.username.Trim().Equals(""))
            {
                Logging.LogEvent(1, "WindowInit", "User is not logged in. Opening connection dialog ...");
                ConnectForm  cf = new ConnectForm();
                DialogResult dr = cf.ShowDialog();
                if (dr == DialogResult.Cancel)
                {
                    CloseApp();
                }
            }

            ReplacePanel <ControlPanel>();
            панельНавигацииToolStripMenuItem.Checked = GlobalSettings.showNavigationPanel;
            ChangeNavPanelVisibility(GlobalSettings.showNavigationPanel);
        }
 public WirelessDoorbell()
 {
     InitializeComponent();
     GlobalSettings.InitThemeAndLang(Controls, this);
     RenderDoorbellImage();
 }
Exemple #9
0
 public ConnectForm()
 {
     InitializeComponent();
     GlobalSettings.InitThemeAndLang(Controls, this);
 }
 public RegisterUser()
 {
     InitializeComponent();
     GlobalSettings.InitThemeAndLang(Controls, this);
 }
 public AboutProgram()
 {
     InitializeComponent();
     GlobalSettings.InitThemeAndLang(Controls, this);
 }