Пример #1
0
        /// <summary>
        /// Initializes an instance of the class <see cref="InteractionService"/>
        /// </summary>
        protected InteractionService()
        {
            this.CurrentArduinoMode = Mode.Unknow;

            this._timer = new Timer(TimeSpan.FromDays(10));
            this._timer.Tick += this.Tick;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the SettingsViewModel class.
        /// </summary>
        public SettingsViewModel()
        {
            this.Settings = new SettingsDesktop();

            if (this.IsInDesignMode)
            {
                this.Settings.ComPort = "COM5";
                this.Settings.CurrentColor = new Color(255, 0, 0);
                this.Settings.CurrentBrightness = (byte)200;
            }
            else
            {
                this.ConnectCommand = new RelayCommand(this.ConnectCommandExecute);
                this.AudioDeviceCommand = new RelayCommand(this.AudioDeviceCommandExecute);
                this.ModeCommand = new RelayCommand(this.ModeCommandExecute);

                this._timer = new Timer(TimeSpan.FromMilliseconds(10));
                this._timer.Tick += this.TimerTick;

                this.Settings.Connected = this.GetService().Connected;
                this.Settings.AudioDevice = Properties.Settings.Default.CurrentAudioDevice;
                this.Settings.ComPort = Properties.Settings.Default.ComPort;
                this.Settings.Mode = Properties.Settings.Default.Mode;
                this.Settings.CurrentColor = Properties.Settings.Default.CurrentColor;
                this.Settings.CurrentBrightness = Properties.Settings.Default.CurrentBrightness;
            }
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the SettingsViewModel class.
        /// </summary>
        public SettingsViewModel()
        {
            this.Settings = new SettingsDesktop();

            if (this.IsInDesignMode)
            {
                this.Settings.ComPort = "COM5";
                this.Settings.CurrentColor = new Color(255, 0, 0);
                this.Settings.CurrentBrightness = (byte)200;
            }
            else
            {
                this.RefreshDeviceListCommand = new RelayCommand(this.RefreshDeviceListCommandExecute);
                this.ConnectCommand = new RelayCommand(this.ConnectCommandExecute);
                this.ModeCommand = new RelayCommand(this.ModeCommandExecute);

                this._timer = new Timer(TimeSpan.FromMilliseconds(100));
                this._timer.Tick += this.TimerTick;

                this.Settings.Connected = App.Service.Connected;
                this.Settings.ComPort = ApplicationSettings.GetSetting<string>("ComPort");
                this.Settings.Mode = ApplicationSettings.GetSetting<Mode>("Mode");
                this.Settings.CurrentColor = ApplicationSettings.GetSetting<Color>("CurrentColor");
                this.Settings.CurrentBrightness = ApplicationSettings.GetSetting<byte>("CurrentBrightness");
            }
        }