コード例 #1
0
ファイル: Controller.cs プロジェクト: Soturion/AquaFan
        /// <summary>
        /// Speichert alle Profile
        /// </summary>
        public void saveAllProfiles()
        {
            BindingList <Profile> lProfilesToDelete = new BindingList <Profile>();

            foreach (Profile p in Profiles)
            {
                if (p.IsAddProfileTab)
                {
                    continue;
                }
                if (p.DeleteProfile)
                {
                    lProfilesToDelete.Add(p);
                    File.Delete(p.ProfilePath);
                }
                else
                {
                    XmlControllerObject.saveProfile(p);
                }
            }

            foreach (Profile p in lProfilesToDelete)
            {
                Profiles.Remove(p);
            }

            checkForActiveProfile();
        }
コード例 #2
0
ファイル: Controller.cs プロジェクト: Soturion/AquaFan
        public Controller(ToolStripStatusLabel _lblStatus, ToolStripMenuItem _languageMenuItem, Form _frmMain, StatusStrip _statusStrip, MenuStrip _menuStrip, Button acceptButton, TabControl tbCntrl)
        {
            lblStatus         = _lblStatus;
            statusStrip       = _statusStrip;
            menuStripCurrent  = _menuStrip;
            frmCurrent        = _frmMain;
            btnAcceptFrmMain  = acceptButton;
            ProfileTabControl = tbCntrl;

            //Config Dateien prüfen
            MissingFileController fileCheck = new MissingFileController();

            //Controler instanziieren
            xmlCntrl = new xmlController(this);
            lngCntrl = new LanguageController(this, XmlControllerObject, _languageMenuItem, _frmMain, menuStripCurrent);

            XmlControllerObject.getDeviceSerial();

            setStatus();

            //Lüfter Werte ändern sobald ein Profil aktiviert wird (True = Lüfter werden sofort übernommen, False = man muss auf "Übernehmen" klicken
            bApplyChangesWhenChangingActiveProfile = XmlControllerObject.changeFanSpeedsByActiveProfile();

            loadProfiles();
            showProfiles();

            if (XmlControllerObject.getApplyValuesAtProgramStartValue())
            {
                applyCurrentProfileChanges();
            }
        }
コード例 #3
0
ファイル: Controller.cs プロジェクト: Eispala/Aquafan
        /// <summary>
        /// Speichert das aktive Profil
        /// </summary>
        public void SaveActiveProfile()
        {
            BindingList <Profile> lProfilesToDelete = new BindingList <Profile>();

            foreach (Profile p in Profiles)
            {
                if (p.IsAddProfileTab)
                {
                    continue;
                }
                if (p.IsActiveProfile)
                {
                    if (p.DeleteProfile)
                    {
                        lProfilesToDelete.Add(p);
                    }

                    XmlControllerObject.saveProfile(p);
                }
                else
                {
                    XmlControllerObject.setProfileInactive(p);
                }
            }

            foreach (Profile p in lProfilesToDelete)
            {
                Profiles.Remove(p);
                ShowProfiles();
            }

            CheckForActiveProfile();
        }
コード例 #4
0
ファイル: Controller.cs プロジェクト: Soturion/AquaFan
        /// <summary>
        /// Aktiviert das übergebene Profil
        /// </summary>
        /// <param name="profileToActivate"></param>
        public void activateProfile(Profile profileToActivate)
        {
            foreach (Profile profile in Profiles)
            {
                if (profile.Text == profileToActivate.Text)
                {
                    profileToActivate.IsActiveProfile            = true;
                    profileToActivate.ProfileRadioButton.Checked = true;
                    CurrentProfile = profileToActivate;
                }
                else
                {
                    profile.IsActiveProfile            = false;
                    profile.ProfileRadioButton.Checked = false;
                }
            }

            if (XmlControllerObject.changeFanSpeedsByActiveProfile())
            {
                saveActiveProfile();
                applyCurrentProfileChanges();
            }
        }
コード例 #5
0
ファイル: Controller.cs プロジェクト: Soturion/AquaFan
 /// <summary>
 /// Setzt den Statustext auf der Hauptform
 /// </summary>
 public void setStatus()
 {
     if (!XmlControllerObject.checkCmdPath())
     {
         lblStatus.Text           = lngCntrl.getVariableText(lngCntrl.CurrentLanguage, "varCmdNotOK");
         statusStrip.BackColor    = Color.Orange;
         btnAcceptFrmMain.Enabled = false;
         return;
     }
     else if (string.IsNullOrEmpty(DeviceSerial))
     {
         lblStatus.Text           = lngCntrl.getVariableText(lngCntrl.CurrentLanguage, "varSerialNotOK");
         statusStrip.BackColor    = Color.Orange;
         btnAcceptFrmMain.Enabled = false;
         return;
     }
     else
     {
         lblStatus.Text           = lngCntrl.getVariableText(lngCntrl.CurrentLanguage, "varCmdOK");
         statusStrip.BackColor    = Color.LightGreen;
         btnAcceptFrmMain.Enabled = true;
     }
 }