Exemple #1
0
        protected override bool SetData(ManualAutoAddData data)
        {
            if (data == null)
            {
                return(false);
            }

            data   = data.DeepClone();
            dataID = data.dataID;

            //深夜時間帯の処理
            if (Settings.Instance.LaterTimeUse == true && DateTime28.IsLateHour(data.PgStartTime.Hour) == true)
            {
                data.ShiftRecDay(-1);
            }

            //曜日の処理、0~6bit目:日~土
            int val = 0;

            chbxList.ForEach(chbx => chbx.IsChecked = (data.dayOfWeekFlag & (0x01 << val++)) != 0);

            checkBox_keyDisabled.IsChecked = data.IsEnabled == false;

            UInt32 hh = data.startTime / (60 * 60);
            UInt32 mm = (data.startTime % (60 * 60)) / 60;
            UInt32 ss = data.startTime % 60;

            comboBox_startHH.SelectedIndex = (int)hh;
            comboBox_startMM.SelectedIndex = (int)mm;
            comboBox_startSS.SelectedIndex = (int)ss;

            //深夜時間帯の処理も含む
            UInt32 endTime = data.startTime + data.durationSecond;

            if (endTime >= comboBox_endHH.Items.Count * 60 * 60 || endTime >= 24 * 60 * 60 &&
                DateTime28.JudgeLateHour(data.PgStartTime.AddSeconds(data.durationSecond), data.PgStartTime) == false)
            {
                //正規のデータであれば、必ず0~23時台かつstartTimeより小さくなる。
                endTime -= 24 * 60 * 60;
            }
            hh = endTime / (60 * 60);
            mm = (endTime % (60 * 60)) / 60;
            ss = endTime % 60;

            comboBox_endHH.SelectedIndex = (int)hh;
            comboBox_endMM.SelectedIndex = (int)mm;
            comboBox_endSS.SelectedIndex = (int)ss;

            textBox_title.Text = data.title;

            UInt64 key = data.Create64Key();

            if (ChSet5.ChList.ContainsKey(key) == true)
            {
                comboBox_service.SelectedItem = ChSet5.ChList[key];
            }
            recSettingView.SetDefSetting(data.recSetting);

            return(true);
        }
 private byte GetWeekFlgMod()
 {
     if (Settings.Instance.LaterTimeUse == true && DateTime28.IsLateHour(ManualAutoAddInfo.PgStartTime.Hour) == true)
     {
         return(ManualAutoAddData.ShiftWeekFlag(ManualAutoAddInfo.dayOfWeekFlag, -1));
     }
     return(ManualAutoAddInfo.dayOfWeekFlag);
 }
        private void SetReserveTimeInfo(ReserveData resInfo)
        {
            if (resInfo == null)
            {
                return;
            }

            try
            {
                Title = ViewUtil.WindowTitleText(resInfo.Title, addMode == AddMode.Add ? "予約登録" : "予約変更");

                //テキストの選択位置を戻す
                textBox_title.Text = null;
                Dispatcher.BeginInvoke(new Action(() => textBox_title.Text = resInfo.Title), DispatcherPriority.Render);

                comboBox_service.SelectedIndex = 0;
                ChSet5Item ch;
                if (ChSet5.ChList.TryGetValue(resInfo.Create64Key(), out ch) == true)
                {
                    comboBox_service.SelectedItem = ch;
                }

                DateTime startTime = resInfo.StartTime;
                DateTime endTime   = resInfo.StartTime.AddSeconds(resInfo.DurationSecond);

                //深夜時間帯の処理
                bool use28      = Settings.Instance.LaterTimeUse == true && (endTime - startTime).TotalDays < 1;
                bool late_start = use28 && startTime.Hour + 24 < comboBox_sh.Items.Count && DateTime28.IsLateHour(startTime.Hour);
                bool late_end   = use28 && endTime.Hour + 24 < comboBox_eh.Items.Count && DateTime28.JudgeLateHour(endTime, startTime);

                datePicker_start.SelectedDate = startTime.Date.AddDays(late_start == true ? -1 : 0);
                comboBox_sh.SelectedIndex     = startTime.Hour + (late_start == true ? 24 : 0);
                comboBox_sm.SelectedIndex     = startTime.Minute;
                comboBox_ss.SelectedIndex     = startTime.Second;

                datePicker_end.SelectedDate = endTime.Date.AddDays(late_end == true ? -1 : 0);
                comboBox_eh.SelectedIndex   = endTime.Hour + (late_end == true ? 24 : 0);
                comboBox_em.SelectedIndex   = endTime.Minute;
                comboBox_es.SelectedIndex   = endTime.Second;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); }
        }
Exemple #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (defKey != null)
            {
                //深夜時間帯の処理
                if (Settings.Instance.LaterTimeUse == true && DateTime28.IsLateHour(defKey.PgStartTime.Hour) == true)
                {
                    defKey.ShiftRecDay(-1);
                }

                if ((defKey.dayOfWeekFlag & 0x01) != 0)
                {
                    checkBox_week0.IsChecked = true;
                }
                if ((defKey.dayOfWeekFlag & 0x02) != 0)
                {
                    checkBox_week1.IsChecked = true;
                }
                if ((defKey.dayOfWeekFlag & 0x04) != 0)
                {
                    checkBox_week2.IsChecked = true;
                }
                if ((defKey.dayOfWeekFlag & 0x08) != 0)
                {
                    checkBox_week3.IsChecked = true;
                }
                if ((defKey.dayOfWeekFlag & 0x10) != 0)
                {
                    checkBox_week4.IsChecked = true;
                }
                if ((defKey.dayOfWeekFlag & 0x20) != 0)
                {
                    checkBox_week5.IsChecked = true;
                }
                if ((defKey.dayOfWeekFlag & 0x40) != 0)
                {
                    checkBox_week6.IsChecked = true;
                }

                checkBox_keyDisabled.IsChecked = defKey.IsEnabled == false;

                UInt32 hh = defKey.startTime / (60 * 60);
                UInt32 mm = (defKey.startTime % (60 * 60)) / 60;
                UInt32 ss = defKey.startTime % 60;

                comboBox_startHH.SelectedIndex = (int)hh;
                comboBox_startMM.SelectedIndex = (int)mm;
                comboBox_startSS.SelectedIndex = (int)ss;

                //深夜時間帯の処理も含む
                UInt32 endTime = defKey.startTime + defKey.durationSecond;
                if (endTime >= comboBox_endHH.Items.Count * 60 * 60 || endTime >= 24 * 60 * 60 &&
                    DateTime28.JudgeLateHour(defKey.PgStartTime.AddSeconds(defKey.durationSecond), defKey.PgStartTime) == false)
                {
                    //正規のデータであれば、必ず0~23時台かつstartTimeより小さくなる。
                    endTime -= 24 * 60 * 60;
                }
                hh = endTime / (60 * 60);
                mm = (endTime % (60 * 60)) / 60;
                ss = endTime % 60;

                comboBox_endHH.SelectedIndex = (int)hh;
                comboBox_endMM.SelectedIndex = (int)mm;
                comboBox_endSS.SelectedIndex = (int)ss;

                textBox_title.Text = defKey.title;

                UInt64 key = defKey.Create64Key();

                if (ChSet5.ChList.ContainsKey(key) == true)
                {
                    comboBox_service.SelectedItem = ChSet5.ChList[key];
                }
                recSettingView.SetDefSetting(defKey.recSetting, true);
            }
        }
        private void SetReserveTime(DateTime startTime, DateTime endTime)
        {
            //深夜時間帯の処理
            bool use28      = Settings.Instance.LaterTimeUse == true && (endTime - startTime).TotalDays < 1;
            bool late_start = use28 && startTime.Hour + 24 < comboBox_sh.Items.Count && DateTime28.IsLateHour(startTime.Hour);
            bool late_end   = use28 && endTime.Hour + 24 < comboBox_eh.Items.Count && DateTime28.JudgeLateHour(endTime, startTime);

            datePicker_start.SelectedDate = startTime.AddDays(late_start == true ? -1 : 0);
            comboBox_sh.SelectedIndex     = startTime.Hour + (late_start == true ? 24 : 0);
            comboBox_sm.SelectedIndex     = startTime.Minute;
            comboBox_ss.SelectedIndex     = startTime.Second;

            datePicker_end.SelectedDate = endTime.AddDays(late_end == true ? -1 : 0);
            comboBox_eh.SelectedIndex   = endTime.Hour + (late_end == true ? 24 : 0);
            comboBox_em.SelectedIndex   = endTime.Minute;
            comboBox_es.SelectedIndex   = endTime.Second;
        }