Beispiel #1
0
        private void OnRestoreDefaults()
        {
            GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);

            if (dlgYesNo != null)
            {
                dlgYesNo.Reset();
                dlgYesNo.SetHeading(927);
                dlgYesNo.SetLine(1, Utility.GetLocalizedText(TextId.RestoreDefaults));
                dlgYesNo.SetLine(2, Utility.GetLocalizedText(TextId.AreYouSure));
                dlgYesNo.SetLine(3, string.Empty);
                dlgYesNo.SetDefaultToYes(false);
                dlgYesNo.DoModal(GetID);

                if (dlgYesNo.IsConfirmed)
                {
                    ConfigurationServiceAgent.SetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CreateVideoThumbnails, null);
                    ConfigurationServiceAgent.SetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AlwaysCreateMetadataFiles, null);
                    ConfigurationServiceAgent.SetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreferredGuideSource, null);
                    ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreRecordsSeconds, null);
                    ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PostRecordsSeconds, null);
                    ConfigurationServiceAgent.SetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilMode, null);
                    ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilValue, null);
                    ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.FreeDiskSpaceInMB, null);
                    ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.MinimumFreeDiskSpaceInMB, null);
                }
            }
        }
Beispiel #2
0
        private string InternalHandleNotificationsCommand(MsnConversation msnConversation, IList <string> arguments)
        {
            string contactMail = msnConversation.Contact.Account;

            lock (_notificationsLock)
            {
                EnsureNotificationContactFilter();

                bool   settingChanged = false;
                string onOff          = arguments.Count > 0 ? arguments[0].Trim() : String.Empty;
                if (onOff == "off")
                {
                    settingChanged = _notificationContactFilter.AddAddress(contactMail);
                }
                else if (onOff == "on")
                {
                    settingChanged = _notificationContactFilter.RemoveAddress(contactMail);
                }
                if (settingChanged)
                {
                    using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
                    {
                        configurationAgent.SetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnNotificationFilterList, _notificationContactFilter.ToString());
                    }
                }
                return(_notificationContactFilter.ContainsAddress(contactMail) ? "Notifications are off." : "Notifications are on.");
            }
        }
Beispiel #3
0
 private void EnsureNotificationContactFilter()
 {
     if (_notificationContactFilter == null)
     {
         using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
         {
             _notificationContactFilter = new AddressList(
                 configurationAgent.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnNotificationFilterList, false));
         }
     }
 }
Beispiel #4
0
 private void UpdateAlertMinutesSetting()
 {
     using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
     {
         int?value = configurationAgent.GetIntValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MinutesBeforeAlert, false);
         if (value.HasValue)
         {
             _alertMinutes = value.Value;
             _recentlyAlerted.Clear();
         }
     }
 }
Beispiel #5
0
        private void ValidateContacts()
        {
            Logger.Verbose("Validating Windows Live contacts...");

            bool reconnect = false;

            using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
            {
                AddressList contactAddresses = new AddressList(
                    configurationAgent.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnContactList, false));

                List <Contact> contactsToRemove = new List <Contact>();
                foreach (Contact contact in _messenger.ContactList.Allowed)
                {
                    if (!contactAddresses.Contains(contact.Account))
                    {
                        contactsToRemove.Add(contact);
                    }
                }
                foreach (Contact contact in contactsToRemove)
                {
                    if (contact.Guid != Guid.Empty)
                    {
                        contact.AppearOffline = true;
                        Logger.Write("Blocked contact: " + contact.Account);
                    }
                }

                foreach (string mailAddress in contactAddresses)
                {
                    Contact contact = FindContactInList(mailAddress);
                    if (contact == null ||
                        contact.Guid == Guid.Empty)
                    {
                        _messenger.ContactService.AddNewContact(mailAddress, "ARGUS TV is inviting you.");
                        Logger.Write("Invited contact: " + contact.Account);
                        reconnect = true;
                    }
                    else if (contact.AppearOffline)
                    {
                        contact.AppearOffline = false;
                        Logger.Write("Unblocked contact: " + contact.Account);
                        reconnect = true;
                    }
                }
            }

            if (reconnect)
            {
                Thread.Sleep(1000);
                DisconnectMessenger();
            }
        }
Beispiel #6
0
        private void OnLoadCanalCommandExecuted(string obj)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (openFileDialog.ShowDialog() == true)
            {
                // C:\Users\rbo\Documents\ScienceAndMaths
                string file = openFileDialog.FileName;

                ICanal canal = ConfigurationServiceAgent.LoadCanalConfiguration(file);

                CanalData = new CanalData(canal);

                ActiveCanalGeometryData = CanalData.GetCanalGeometryData(CanalData.Canal.CanalStretches.Select(cs => cs.Id).FirstOrDefault());

                RaisePropertiesChanged();
            }
        }
Beispiel #7
0
 private void SaveSettings()
 {
     Log.Debug("ServerSettingsBase: SaveSettings()");
     if (_autoCreateThumbsButton.IsEnabled)
     {
         ConfigurationServiceAgent.SetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CreateVideoThumbnails, _autoCreateThumbsButton.Selected);
     }
     if (_metaDataForRecsButton.IsEnabled)
     {
         ConfigurationServiceAgent.SetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AlwaysCreateMetadataFiles, _metaDataForRecsButton.Selected);
     }
     if (_guideSourceButton.IsEnabled)
     {
         ConfigurationServiceAgent.SetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreferredGuideSource, _currentGuideSource.ToString());
     }
     if (_preRecordButton.IsEnabled)
     {
         ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreRecordsSeconds, Int32.Parse(_preRecordButton.SpinLabel) * 60);
     }
     if (_postRecordButton.IsEnabled)
     {
         ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PostRecordsSeconds, Int32.Parse(_postRecordButton.SpinLabel) * 60);
     }
     if (_keepUntilModeButton.IsEnabled)
     {
         ConfigurationServiceAgent.SetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilMode, _currentKeepUntilMode.ToString());
     }
     if (_keepUntilValueButton.IsEnabled)
     {
         ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilValue, _currentKeepUntilValue);
     }
     if (_freeDiskSpaceSpinButton.IsEnabled)
     {
         ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.FreeDiskSpaceInMB, Int32.Parse(_freeDiskSpaceSpinButton.SpinLabel) * 1000);
     }
     if (_minFreeDiskSpaceSpinButton.IsEnabled)
     {
         ConfigurationServiceAgent.SetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.MinimumFreeDiskSpaceInMB, Int32.Parse(_minFreeDiskSpaceSpinButton.SpinLabel) * 1000);
     }
 }
Beispiel #8
0
        protected override void Run()
        {
            Logger.Write(_threadName + " thread started.");

            _wakeUpEvent = new AutoResetEvent(false);
            try
            {
                Logger.Write("Starting service.");

                _messenger.ConnectionEstablished              += NameserverProcessor_ConnectionEstablished;
                _messenger.ConnectingException                += NameserverProcessor_ConnectingException;
                _messenger.Nameserver.ExceptionOccurred       += Nameserver_ExceptionOccurred;
                _messenger.Nameserver.AuthenticationError     += Nameserver_AuthenticationError;
                _messenger.Nameserver.ServerErrorReceived     += Nameserver_ServerErrorReceived;
                _messenger.Nameserver.SignedIn                += Nameserver_SignedIn;
                _messenger.MessageManager.TextMessageReceived += MessageManager_TextMessageReceived;
                _messenger.Nameserver.ContactOnline           += Nameserver_ContactOnline;
                _messenger.Nameserver.ContactOffline          += Nameserver_ContactOffline;

                _nextPersonalMessageRefreshTime = DateTime.Now.AddSeconds(5);
                _nextAlertsCheckTime            = DateTime.Now.AddSeconds(_checkAlertsIntervalSeconds);
                do
                {
                    try
                    {
                        EnsureArgusTVConnection();
                        if (ServiceChannelFactories.IsInitialized)
                        {
                            EnsureEventsListenerService();

                            if (_messenger.Connected)
                            {
                                if (_messenger.Nameserver.IsSignedIn)
                                {
                                    if (_refreshMessageAndStatus)
                                    {
                                        RefreshBotPersonalMessage();
                                        _refreshMessageAndStatus = false;
                                    }

                                    // If needed, make sure our contact list is up-to-date.
                                    if (!_contactsValidated)
                                    {
                                        ValidateContacts();
                                        _contactsValidated = true;
                                    }

                                    if (DateTime.Now >= _nextPersonalMessageRefreshTime)
                                    {
                                        _nextPersonalMessageRefreshTime = DateTime.MaxValue;
                                        RefreshBotPersonalMessage();
                                    }

                                    if (_messenger.Owner.Name != "ARGUS TV")
                                    {
                                        _messenger.Owner.Name = "ARGUS TV";
                                    }

                                    if (DateTime.Now >= _nextAlertsCheckTime)
                                    {
                                        HandleAlerts();
                                        _nextAlertsCheckTime = DateTime.Now.AddSeconds(_checkAlertsIntervalSeconds);
                                    }
                                }
                                else
                                {
                                    //Logger.Verbose("Connected to Windows Live, but not signed in yet...");
                                }
                            }
                            else
                            {
                                using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
                                {
                                    _messenger.Credentials.Account =
                                        configurationAgent.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnAccount, false);
                                    _messenger.Credentials.Password =
                                        configurationAgent.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnPassword, false);
                                    if (!String.IsNullOrEmpty(_messenger.Credentials.Account))
                                    {
                                        Logger.Info("Connecting to Windows Live as '{0}'...", _messenger.Credentials.Account);
                                        _messenger.Connect();
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(ex.ToString());
                        if (_messenger.Connected)
                        {
                            DisconnectMessenger();
                        }
                    }
                } while (0 != WaitHandle.WaitAny(new WaitHandle[] { this.StopThreadEvent, _wakeUpEvent }, 1000, false));

                StopEventsListenerService();
                if (_messenger.Connected)
                {
                    DisconnectMessenger();
                }

                Logger.Write("Service ended.");
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                using (ServiceController controller = new ServiceController("ArgusTVMessenger"))
                {
                    try { controller.Stop(); }
                    catch { }
                }
            }
            finally
            {
                _wakeUpEvent.Close();
                _wakeUpEvent = null;
            }

            Logger.Write(_threadName + " thread ended.");
        }
Beispiel #9
0
        private void ValidateContacts()
        {
            Logger.Verbose("Validating Windows Live contacts...");

            bool reconnect = false;

            using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
            {
                AddressList contactAddresses = new AddressList(
                    configurationAgent.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnContactList, false));

                List<Contact> contactsToRemove = new List<Contact>();
                foreach (Contact contact in _messenger.ContactList.Allowed)
                {
                    if (!contactAddresses.Contains(contact.Account))
                    {
                        contactsToRemove.Add(contact);
                    }
                }
                foreach (Contact contact in contactsToRemove)
                {
                    if (contact.Guid != Guid.Empty)
                    {
                        contact.AppearOffline = true;
                        Logger.Write("Blocked contact: " + contact.Account);
                    }
                }

                foreach (string mailAddress in contactAddresses)
                {
                    Contact contact = FindContactInList(mailAddress);
                    if (contact == null
                        || contact.Guid == Guid.Empty)
                    {
                        _messenger.ContactService.AddNewContact(mailAddress, "ARGUS TV is inviting you.");
                        Logger.Write("Invited contact: " + contact.Account);
                        reconnect = true;
                    }
                    else if (contact.AppearOffline)
                    {
                        contact.AppearOffline = false;
                        Logger.Write("Unblocked contact: " + contact.Account);
                        reconnect = true;
                    }
                }
            }

            if (reconnect)
            {
                Thread.Sleep(1000);
                DisconnectMessenger();
            }
        }
Beispiel #10
0
 private void UpdateAlertMinutesSetting()
 {
     using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
     {
         int? value = configurationAgent.GetIntValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MinutesBeforeAlert, false);
         if (value.HasValue)
         {
             _alertMinutes = value.Value;
             _recentlyAlerted.Clear();
         }
     }
 }
Beispiel #11
0
        private string InternalHandleNotificationsCommand(MsnConversation msnConversation, IList<string> arguments)
        {
            string contactMail = msnConversation.Contact.Account;
            lock (_notificationsLock)
            {
                EnsureNotificationContactFilter();

                bool settingChanged = false;
                string onOff = arguments.Count > 0 ? arguments[0].Trim() : String.Empty;
                if (onOff == "off")
                {
                    settingChanged = _notificationContactFilter.AddAddress(contactMail);
                }
                else if (onOff == "on")
                {
                    settingChanged = _notificationContactFilter.RemoveAddress(contactMail);
                }
                if (settingChanged)
                {
                    using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
                    {
                        configurationAgent.SetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnNotificationFilterList, _notificationContactFilter.ToString());
                    }
                }
                return _notificationContactFilter.ContainsAddress(contactMail) ? "Notifications are off." : "Notifications are on.";
            }
        }
Beispiel #12
0
 private void EnsureNotificationContactFilter()
 {
     if (_notificationContactFilter == null)
     {
         using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
         {
             _notificationContactFilter = new AddressList(
                 configurationAgent.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnNotificationFilterList, false));
         }
     }
 }
Beispiel #13
0
        protected override void Run()
        {
            Logger.Write(_threadName + " thread started.");

            _wakeUpEvent = new AutoResetEvent(false);
            try
            {
                Logger.Write("Starting service.");

                _messenger.ConnectionEstablished += NameserverProcessor_ConnectionEstablished;
                _messenger.ConnectingException += NameserverProcessor_ConnectingException;
                _messenger.Nameserver.ExceptionOccurred += Nameserver_ExceptionOccurred;
                _messenger.Nameserver.AuthenticationError += Nameserver_AuthenticationError;
                _messenger.Nameserver.ServerErrorReceived += Nameserver_ServerErrorReceived;
                _messenger.Nameserver.SignedIn += Nameserver_SignedIn;
                _messenger.MessageManager.TextMessageReceived += MessageManager_TextMessageReceived;
                _messenger.Nameserver.ContactOnline += Nameserver_ContactOnline;
                _messenger.Nameserver.ContactOffline += Nameserver_ContactOffline;

                _nextPersonalMessageRefreshTime = DateTime.Now.AddSeconds(5);
                _nextAlertsCheckTime = DateTime.Now.AddSeconds(_checkAlertsIntervalSeconds);
                do
                {
                    try
                    {
                        EnsureArgusTVConnection();
                        if (ServiceChannelFactories.IsInitialized)
                        {
                            EnsureEventsListenerService();

                            if (_messenger.Connected)
                            {
                                if (_messenger.Nameserver.IsSignedIn)
                                {
                                    if (_refreshMessageAndStatus)
                                    {
                                        RefreshBotPersonalMessage();
                                        _refreshMessageAndStatus = false;
                                    }

                                    // If needed, make sure our contact list is up-to-date.
                                    if (!_contactsValidated)
                                    {
                                        ValidateContacts();
                                        _contactsValidated = true;
                                    }

                                    if (DateTime.Now >= _nextPersonalMessageRefreshTime)
                                    {
                                        _nextPersonalMessageRefreshTime = DateTime.MaxValue;
                                        RefreshBotPersonalMessage();
                                    }

                                    if (_messenger.Owner.Name != "ARGUS TV")
                                    {
                                        _messenger.Owner.Name = "ARGUS TV";
                                    }

                                    if (DateTime.Now >= _nextAlertsCheckTime)
                                    {
                                        HandleAlerts();
                                        _nextAlertsCheckTime = DateTime.Now.AddSeconds(_checkAlertsIntervalSeconds);
                                    }
                                }
                                else
                                {
                                    //Logger.Verbose("Connected to Windows Live, but not signed in yet...");
                                }
                            }
                            else
                            {
                                using (ConfigurationServiceAgent configurationAgent = new ConfigurationServiceAgent())
                                {
                                    _messenger.Credentials.Account =
                                        configurationAgent.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnAccount, false);
                                    _messenger.Credentials.Password =
                                        configurationAgent.GetStringValue(ConfigurationModule.Messenger, ConfigurationKey.Messenger.MsnPassword, false);
                                    if (!String.IsNullOrEmpty(_messenger.Credentials.Account))
                                    {
                                        Logger.Info("Connecting to Windows Live as '{0}'...", _messenger.Credentials.Account);
                                        _messenger.Connect();
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Error(ex.ToString());
                        if (_messenger.Connected)
                        {
                            DisconnectMessenger();
                        }
                    }
                } while (0 != WaitHandle.WaitAny(new WaitHandle[] { this.StopThreadEvent, _wakeUpEvent }, 1000, false));

                StopEventsListenerService();
                if (_messenger.Connected)
                {
                    DisconnectMessenger();
                }

                Logger.Write("Service ended.");
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                using (ServiceController controller = new ServiceController("ArgusTVMessenger"))
                {
                    try { controller.Stop(); }
                    catch { }
                }
            }
            finally
            {
                _wakeUpEvent.Close();
                _wakeUpEvent = null;
            }

            Logger.Write(_threadName + " thread ended.");
        }
Beispiel #14
0
        private void LoadSettings()
        {
            Log.Debug("ServerSettingsBase: LoadSettings()");
            bool?_autoCreateThumbs         = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CreateVideoThumbnails, true);
            bool?_metaDataForRecs          = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AlwaysCreateMetadataFiles, true);
            bool?_swapTunerPriority        = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.SwapRecorderTunerPriorityForRecordings, true);
            bool?_autoCombineConsecutive   = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.AutoCombineConsecutiveRecordings, true);
            bool?_combineConsecutive       = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CombineConsecutiveRecordings, true);
            bool?_combineOnlyOnSameChannel = ConfigurationServiceAgent.GetBooleanValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.CombineRecordingsOnlyOnSameChannel, true);

            int?_preRecord        = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreRecordsSeconds, true);
            int?_postRecord       = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PostRecordsSeconds, true);
            int?_keepUntilValue   = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilValue, true);
            int?_freeDiskSpace    = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.FreeDiskSpaceInMB, true);
            int?_minFreeDiskSpace = ConfigurationServiceAgent.GetIntValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.MinimumFreeDiskSpaceInMB, true);

            string _keepUntilMode = ConfigurationServiceAgent.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.DefaultKeepUntilMode, true);
            string _guideSource   = ConfigurationServiceAgent.GetStringValue(ConfigurationModule.Scheduler, ConfigurationKey.Scheduler.PreferredGuideSource, true);

            if (_autoCreateThumbs.HasValue)
            {
                _autoCreateThumbsButton.Selected = _autoCreateThumbs.Value;
            }
            if (_metaDataForRecs.HasValue)
            {
                _metaDataForRecsButton.Selected = _metaDataForRecs.Value;
            }
            if (_keepUntilValue.HasValue)
            {
                _currentKeepUntilValue = _keepUntilValue.Value;
            }
            if (_keepUntilMode != string.Empty)
            {
                _currentKeepUntilMode = GetKeepUntilModeFromString(_keepUntilMode);
            }
            if (_guideSource != string.Empty)
            {
                _currentGuideSource = GetGuideSourceFromString(_guideSource);
            }

            _autoCreateThumbsButton.IsEnabled     = _autoCreateThumbs.HasValue;
            _metaDataForRecsButton.IsEnabled      = _metaDataForRecs.HasValue;
            _preRecordButton.IsEnabled            = _preRecord.HasValue;
            _postRecordButton.IsEnabled           = _postRecord.HasValue;
            _keepUntilValueButton.IsEnabled       = _keepUntilValue.HasValue;
            _freeDiskSpaceSpinButton.IsEnabled    = _freeDiskSpace.HasValue;
            _minFreeDiskSpaceSpinButton.IsEnabled = _minFreeDiskSpace.HasValue;

            if (_preRecord.HasValue)
            {
                int  prerec           = _preRecord.Value / 60;
                bool valueFoundInList = false;

                for (int i = 0; i <= 60; i++)
                {
                    _preRecordButton.AddSpinLabel(i.ToString(), 0);
                    if (i == prerec)
                    {
                        valueFoundInList = true;
                    }
                }

                if (valueFoundInList)
                {
                    _preRecordButton.SpinValue = prerec;
                }
                else
                {
                    _preRecordButton.AddSpinLabel(prerec.ToString(), 0);
                    _preRecordButton.SpinValue = _preRecordButton.SpinMaxValue() - 1;
                }
            }
            if (_postRecord.HasValue)
            {
                int  postrec          = _postRecord.Value / 60;
                bool valueFoundInList = false;

                for (int i = 0; i <= 60; i++)
                {
                    _postRecordButton.AddSpinLabel(i.ToString(), 0);
                    if (i == postrec)
                    {
                        valueFoundInList = true;
                    }
                }

                if (valueFoundInList)
                {
                    _postRecordButton.SpinValue = postrec;
                }
                else
                {
                    _postRecordButton.AddSpinLabel(postrec.ToString(), 0);
                    _postRecordButton.SpinValue = _postRecordButton.SpinMaxValue() - 1;
                }
            }
            if (_freeDiskSpace.HasValue)
            {
                int  freespace        = _freeDiskSpace.Value / 1000;
                bool valueFoundInList = false;

                for (int i = 1; i < 1000; i++)
                {
                    _freeDiskSpaceSpinButton.AddSpinLabel(i.ToString(), 0);
                    if (i == freespace)
                    {
                        valueFoundInList = true;
                    }
                }

                if (valueFoundInList)
                {
                    _freeDiskSpaceSpinButton.SpinValue = freespace - 1;
                }
                else
                {
                    _freeDiskSpaceSpinButton.AddSpinLabel(freespace.ToString(), 0);
                    _freeDiskSpaceSpinButton.SpinValue = _freeDiskSpaceSpinButton.SpinMaxValue() - 1;
                }
            }
            if (_minFreeDiskSpace.HasValue)
            {
                int  freespace        = _minFreeDiskSpace.Value / 1000;
                bool valueFoundInList = false;

                for (int i = 1; i <= 1000; i++)
                {
                    _minFreeDiskSpaceSpinButton.AddSpinLabel(i.ToString(), 0);
                    if (i == freespace)
                    {
                        valueFoundInList = true;
                    }
                }

                if (valueFoundInList)
                {
                    _minFreeDiskSpaceSpinButton.SpinValue = freespace - 1;
                }
                else
                {
                    _minFreeDiskSpaceSpinButton.AddSpinLabel(freespace.ToString(), 0);
                    _minFreeDiskSpaceSpinButton.SpinValue = _minFreeDiskSpaceSpinButton.SpinMaxValue() - 1;
                }
            }
        }