예제 #1
0
 public GasBoxPreheatingSubForm(DynoCmd dynoCmd, MainSetting mainCfg, Dictionary <Form, bool> dicResults)
 {
     InitializeComponent();
     _lastHeight      = Height;
     _dynoCmd         = dynoCmd;
     _mainCfg         = mainCfg;
     _dicResults      = dicResults;
     _timer           = new System.Timers.Timer(_mainCfg.RealtimeInterval);
     _timer.Elapsed  += OnTimer;
     _timer.AutoReset = true;
     _step            = -1;
     _iResults        = new int[] { 0, 0, 0, 0, 0 };
 }
예제 #2
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainPageViewModel()
        {
            //プロパティの初期化
            this.TweetWord         = ReactiveProperty.FromObject(this._setting, x => x.TweetWord);
            this.SettingText       = new ReactiveProperty <string>(this.TweetWord.Value);
            this.Message           = new ReactiveProperty <string>("");
            this.IsVisibleSetting  = new ReactiveProperty <bool>(false);
            this.SettingButtonText = new ReactiveProperty <string>(SettingButtonTextList[SettingButtonTextIndex]);

            //コマンドの初期化
            this.TweetCommand   = this.TweetWord.Select(s => IsTweet(s)).ToReactiveCommand().AddTo(this.Disposable);
            this.SettingCommand = new ReactiveCommand().AddTo(this.Disposable);

            //ツイートコマンドの実装
            this.TweetCommand.Subscribe(async _ =>
            {
                //トークン初期化(すでにトークンが存在する場合は何もしない)
                var init = await _tweet.InitTokenAsync(this._setting.AccessToken, this._setting.AccessTokenSecret);
                //ツイート
                var res = await _tweet.TweetTextAsync(TweetWord.Value);
                //アクセストークンをセーブ(変更がない場合はファイルに書き込まれません)
                this._setting.SetAccessToken(_tweet.Token.AccessToken, _tweet.Token.AccessTokenSecret);

                if (res != null)
                {
                    this.Message.Value = this.TweetWord.Value;                              //メッセージ欄にツイート文を表示
                }
                else
                {
                    this.Message.Value = this._tweet.LastErrMessage;                        //エラーのときはエラーメッセージを表示
                }
            });

            //ツイート文設定コマンドの実装
            this.SettingCommand.Subscribe(_ =>
            {
                //ファイルに設定をセーブ
                if (this.SettingText.Value != this.TweetWord.Value)
                {
                    MainSetting.Save(this._setting);
                }

                //ツイート文を変更
                this.TweetWord.Value = this.SettingText.Value;
                //ツイート文設定エリアの表示切替
                this.IsVisibleSetting.Value = !this.IsVisibleSetting.Value;

                //ボタンテキスト設定、確定の切り替え
                this.SettingButtonText.Value = SettingButtonTextList[SettingButtonTextIndex ^= 1];
            });
        }
예제 #3
0
 public HomeController(IStationDtoAccessLayer stationDtoAcessLayer, IOptions <MainSetting> settingsOptions, IMapper mapper)
 {
     _stationDtoAcessLayer = stationDtoAcessLayer;
     _settingsOptions      = settingsOptions.Value;
     _mapper = mapper;
 }