Example #1
0
        private void reserve_proc(ExecutedRoutedEventArgs e, int proc)
        {
            if (CmdExeUtil.IsMessageBeforeCommand(e) == true)
            {
                if (MessageBox.Show("予約を" + cmdMsg[proc] + "します。\r\nよろしいですか?", cmdMsg[proc] + "の確認", MessageBoxButton.OKCancel) != MessageBoxResult.OK)
                {
                    return;
                }
            }

            bool ret = false;

            if (proc == 0)
            {
                ret = MenuUtil.ReserveAdd(eventInfo.IntoList(), recSettingView.GetRecSetting());
            }
            else
            {
                List <ReserveData> list = GetReserveList();
                if (proc == 1)
                {
                    RecSettingData recSet = recSettingView.GetRecSetting();
                    list.ForEach(data => data.RecSetting = recSet);
                    ret = MenuUtil.ReserveChange(list);
                }
                else
                {
                    ret = MenuUtil.ReserveDelete(list);
                }
            }

            StatusManager.StatusNotifySet(ret, "録画予約を" + cmdMsg[proc]);

            if (ret == false)
            {
                return;
            }
            if (KeepWin == false)
            {
                this.Close();
            }
        }
Example #2
0
        private void reserve_add_chg(ExecutedRoutedEventArgs e, int proc)
        {
            try
            {
                if (CheckReserveChange(e, proc) == false)
                {
                    return;
                }

                var resInfo = reserveInfo.DeepClone();

                if (resModeProgram == true)
                {
                    if (GetReserveTimeInfo(ref resInfo) == -2)
                    {
                        MessageBox.Show("終了日時が開始日時より前です");
                        return;
                    }

                    //サービスや時間が変わったら、個別予約扱いにする。タイトルのみ変更は見ない。
                    if (resInfo.EventID != 0xFFFF || reserveInfo.IsSamePg(resInfo) == false)
                    {
                        resInfo.EventID = 0xFFFF;
                        resInfo.ReleaseAutoAdd();
                    }
                }
                else
                {
                    //EPG予約に変える場合、またはEPG予約で別の番組に変わる場合
                    if (eventInfoNow != null && (reserveInfo.IsManual == true || reserveInfo.IsSamePg(eventInfoNow) == false))
                    {
                        //基本的にAddReserveEpgWindowと同じ処理内容
                        if (MenuUtil.CheckReservable(eventInfoNow.IntoList()) == null)
                        {
                            return;
                        }
                        eventInfoNow.ToReserveData(ref resInfo);
                        resInfo.ReleaseAutoAdd();
                    }
                }
                if (checkBox_releaseAutoAdd.IsChecked == true)
                {
                    resInfo.ReleaseAutoAdd();
                }

                resInfo.RecSetting = recSettingView.GetRecSetting();

                bool           ret    = false;
                HashSet <uint> oldset = null;
                if (proc == 0)
                {
                    resInfo.Comment = "";
                    oldset          = new HashSet <uint>(CommonManager.Instance.DB.ReserveList.Keys);
                    ret             = MenuUtil.ReserveAdd(resInfo.IntoList());
                    StatusManager.StatusNotifySet(ret, "録画予約を追加");
                }
                else
                {
                    ret = MenuUtil.ReserveChange(resInfo.IntoList());
                    StatusManager.StatusNotifySet(ret, "録画予約を変更");
                }
                if (ret == false)
                {
                    return;
                }

                if (KeepWin == false)
                {
                    this.Close();
                    return;
                }

                if (proc == 0)
                {
                    var list = new List <ReserveData>();
                    CommonManager.CreateSrvCtrl().SendEnumReserve(ref list);
                    var newlist = list.Where(rs => oldset.Contains(rs.ReserveID) == false).ToList();
                    if (newlist.Count == 1)
                    {
                        ChangeData(newlist[0]);
                    }
                }
                SetReserveTabHeader(false);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }