Example #1
0
        private void AddAdmissionDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            //予約枠手動登録ダイアログの登録ボタン
            var title      = AddAdmissionDialogProgramTitle.Text;
            var id         = AddAdmissionDialogProgramID.Text;
            var datePicker = AddAdmissionDialogDatePicker.Date;
            var timePicker = AddAdmissionDialogTimePicker.Time;

            //非表示
            AddAdmissionDialog.Hide();
            if (title != null && id != null && datePicker != null && timePicker != null)
            {
                //Dateに時間追加すりゅ
                var date = DateTime.Parse($"{datePicker.Year}/{datePicker.Month}/{datePicker.Day} {timePicker.Hours}:{timePicker.Minutes}:00");
                //UnixTimeへ
                var unix = new DateTimeOffset(date.Ticks, new TimeSpan(+09, 00, 00));
                //追加する
                autoAdmissionList.addAdmission(title, id, unix.ToUnixTimeSeconds());
            }
        }
Example #2
0
        private async void AddAdmissionDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            var id = AddAdmissionDialogProgramID.Text;
            //予約枠自動入場 手動追加 APIで自動取得 押したとき
            //APIを叩く(https://live2.nicovideo.jp/watch/{LiveID}/programinfo)
            var nicoProgramInfo = new NicoLiveProgramInfo();
            var json            = await nicoProgramInfo.getProgramInfo(id);

            if (json != null)
            {
                //予約枠?
                if (json.data.status == "reserved")
                {
                    AddAdmissionDialogProgramTitle.Text = json.data.title;
                    //UnixTime->DateTime
                    var dateTime = DateTimeOffset.FromUnixTimeSeconds(json.data.beginAt).LocalDateTime;
                    //TimeSpan作ってTimePickerに反映させる
                    var timeSpan = new TimeSpan(dateTime.Hour, dateTime.Minute, 0);
                    //適用
                    AddAdmissionDialogDatePicker.Date = dateTime;
                    AddAdmissionDialogTimePicker.Time = timeSpan;
                    //何故か消えるので再表示
                    await AddAdmissionDialog.ShowAsync();
                }
                else
                {
                    //予約枠以外は追加できないようにする
                    ContentDialog errorDiaog = new ContentDialog
                    {
                        Title           = "予約枠以外は利用できません。",
                        CloseButtonText = "閉じる"
                    };
                    await errorDiaog.ShowAsync();
                }
            }
        }
Example #3
0
 private async void AddAdmissionButotn_Click(object sender, RoutedEventArgs e)
 {
     //予約枠自動入場リストの手動追加ボタン
     await AddAdmissionDialog.ShowAsync();
 }