コード例 #1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="dialogService"></param>
        public MainPageViewModel(IPageDialogService dialogService)
        {
            TraceUtility.Trace();

            _dialogService = dialogService;

            DateTime now = DateTime.Now;

            StandardDate.Value = now;
            InitialDate.Value  = now;

            // 日付範囲を更新する。
            DateRangeProp.Value = new DateRange
            {
                StandardDate = DateTime.Now.Date,
                PastDays     = 1,
                FutureDays   = 2,
            };

            // 適用ボタンコマンドの処理。
            ApplyCmd.Subscribe(_ =>
            {
                OnApplyCmd();
            });

            // 今日ボタンコマンドの処理。
            TodayCmd.Subscribe(_ =>
            {
                Debug.WriteLine("今日ボタンタップ");
                SelectedDate.Value = new DateListPickerItem {
                    Date = DateTime.Now.Date
                };
            });

            // 選択日付表示ボタンコマンドの処理。
            ShowCmd.Subscribe(_ =>
            {
                string msg;
                if (SelectedDate.Value == null)
                {
                    msg = "日付は選択されていません";
                }
                else
                {
                    string dateText = SelectedDate.Value?.Date.ToString("yyyy/MM/dd HH:mm:ss");
                    msg             = $"選択日付変更!" + Environment.NewLine + $"{dateText}";
                }

                Debug.WriteLine(msg);
                _dialogService.DisplayAlertAsync("日付", msg, "OK");
            });
        }
コード例 #2
0
 static extern bool ShowWindow(IntPtr hWnd, ShowCmd nCmdShow);