/// <summary>
        /// Sets the control data, remove event handers to prevent an event call to the parent that the component changed in this case
        /// </summary>
        /// <param name="list"></param>
        public void SetControl(IEnumerable <IComponentData> list)
        {
            RemoveEventHandlers();

            _generalSettingsData = list.OfType <GeneralSettingsData>().FirstOrDefault();

            activityTimeout_ComboBox.choice_Combo.SelectedIndex = _inactivityTimeValues.FindIndex(x => x == _generalSettingsData.ActivityTimeout.Key);
            activityTimeout_ComboBox.onOff_CheckBox.Checked     = _generalSettingsData.ActivityTimeout.Value;

            sleepTimer_ComboBox.choice_Combo.SelectedIndex = _sleepTimeValues.FindIndex(x => x == _generalSettingsData.SleepTimer.Key);
            sleepTimer_ComboBox.onOff_CheckBox.Checked     = _generalSettingsData.SleepTimer.Value;

            ipAddress_Control.ipAddressControl.Text  = _generalSettingsData.ServerAddress.Key;
            ipAddress_Control.onOff_CheckBox.Checked = _generalSettingsData.ServerAddress.Value;

            port_TextBox.text_Box.Text          = _generalSettingsData.Port.Key;
            port_TextBox.onOff_CheckBox.Checked = _generalSettingsData.Port.Value;

            syncTime_ComboBox.choice_Combo.SelectedIndex = _syncTimeValues.FindIndex(x => x == _generalSettingsData.SyncTime.Key);
            syncTime_ComboBox.onOff_CheckBox.Checked     = _generalSettingsData.SyncTime.Value;

            timeZone_ComboBox.choice_Combo.SelectedIndex = _timeZones.ToList().FindIndex(x => x.Id == _generalSettingsData.TimeZone.Key.Id);
            timeZone_ComboBox.onOff_CheckBox.Checked     = _generalSettingsData.TimeZone.Value;

            date_TimePicker.dateTime.Value         = _generalSettingsData.CurrentDate.Key;
            date_TimePicker.onOff_CheckBox.Checked = _generalSettingsData.CurrentDate.Value;

            time_TimePicker.dateTime.Value         = _generalSettingsData.CurrentTime.Key;
            time_TimePicker.onOff_CheckBox.Checked = _generalSettingsData.CurrentTime.Value;

            defaultKeyLanguage_CheckBox.Checked = _generalSettingsData.DefaultToEnglish.Key;
            AutoSyncTime_CheckBox.Checked       = _generalSettingsData.SyncWithServer.Key;
            //SETUP controls
            AddEventHandlers();
        }
Exemplo n.º 2
0
        private void SaveData()
        {
            if (!Directory.Exists(_savesPath))
            {
                Directory.CreateDirectory(_savesPath);
            }

            SerializationHelper.Serialize(_wallpapersSavePath, _wallpaperController.Wallpapers as IEnumerable <Wallpaper>,
                                          typeof(MatrixTransform));

            SerializationHelper.Serialize(_phrasesSavePath, _wallpaperController.PhrasesGroups as IEnumerable <PhrasesGroup>,
                                          typeof(MatrixTransform));

            GeneralSettingsData settingsData = new GeneralSettingsData(_selectedSound, Wallpaper.GeneralDefaultFont,
                                                                       Wallpaper.GeneralDefaultStyle, _wallpaperController.DefaultSignature, _wallpaperController.UpdateFrequency,
                                                                       _wallpaperController.WallpaperUpdateOrder, _wallpaperController.PhraseUpdateOrder);

            SerializationHelper.Serialize(_generalSettingsSavePath, settingsData, typeof(MatrixTransform));
        }
        public GeneralSettingsControl()
        {
            InitializeComponent();



            time_TimePicker.FormatTime(1);

            _generalSettingsData = new GeneralSettingsData();
            //Initialize Data
            activityTimeout_ComboBox.choice_Combo.DataSource = _inactivityTimeValues;
            sleepTimer_ComboBox.choice_Combo.DataSource      = _sleepTimeValues;
            syncTime_ComboBox.choice_Combo.DataSource        = _syncTimeValues;
            timeZone_ComboBox.choice_Combo.DataSource        = _timeZones;


            //Set Event Handlers
            AutoSyncTime_CheckBox.CheckedChanged += Sync_Check;
            Sync_Check(null, null);

            AddEventHandlers();
        }