Пример #1
0
 /// <summary>
 /// カレンダーを作成するメソッド
 /// </summary>
 /// <param name="calData">カレンダーデータクラス</param>
 /// <param name="option">オプションクラス</param>
 public void SetOneCalender(CalenderData calData, Option option)
 {
     this.Entity = this.SetCalender(calData, option);
     this.ChangeWeekText(option.IsDatePrintChange);
     this.ChangeColorTextColor(option.IsTodayColorChange);
     calData.Date = calData.Date.AddMonths(1);
 }
Пример #2
0
        /// <summary>
        /// 日付をリストにするクラス
        /// </summary>
        /// <param name="entity">Entityクラス</param>
        /// <param name="data">Dataクラス</param>
        /// <param name="col">横の位置</param>
        /// <param name="row">縦の位置</param>
        /// <param name="option">Optionクラス</param>
        private void DaysCreate(CalenderCreateEntity entity, CalenderData data, int col, int row, Option option)
        {
            var startPoint = col;

            for (var i = 0; i < data.CalenderLastDay; i++)
            {
                this.calenderDay = new CalenderDay();
                this.DayCreate(this.calenderDay, i, col, row);

                // 曜日の色を変える処理
                this.DateColorChange(col, this.calenderDay);

                // 当日かどうかの判断
                if (option.IsTodayColorChange && int.Parse(this.calenderDay.Day) == DateTime.Now.Day && data.Date.Year == DateTime.Now.Year && data.Date.Month == DateTime.Now.Month)
                {
                    this.calenderDay.IsToday = true;
                }

                entity.CalenderDays.Add(this.calenderDay);
                col++;

                // Gridが6*7の為
                if (col > 6)
                {
                    row++;
                    col = 0;
                }
            }

            // デザイン用にスペースを作る処理 必ず6*7で作る
            // 最上段のデザイン
            for (var x = 0; x < 7; x++)
            {
                this.calenderDay = new CalenderDay()
                {
                    Col = x,
                    Row = 0,
                };
                entity.CalenderDays.Add(this.calenderDay);
            }

            // LastDayのRowから最下段までのデザイン
            for (int y = row; y < 6; y++)
            {
                for (int x = 0; x < 7; x++)
                {
                    this.calenderDay = new CalenderDay()
                    {
                        Col = x,
                        Row = y,
                    };
                    entity.CalenderDays.Add(this.calenderDay);
                }

                col = 0;
            }
        }
        /// <summary>
        /// カレンダーを作成するメソッド
        /// </summary>
        /// <param name="data">カレンダーデータクラス</param>
        /// <param name="op">オプションクラス</param>
        public void SetSomeCalender(CalenderData data, Option op)
        {
            this.Op = op;
            for (int i = 0; i < 12; i++)
            {
                var calEntity = this.SetCalender(data, op);
                this.calenderEntitys.Add(calEntity);
                data.Date = data.Date.AddMonths(1);
            }

            this.ChangeWeekText(op.IsDatePrintChange);
            this.ChangeColorTextColor(op.IsTodayColorChange);
        }
Пример #4
0
        /// <summary>
        /// 検索ボタンが押されたときのイベント処理メソッド
        /// </summary>
        /// <param name="data">カレンダーデータクラス</param>
        public void SearchButtonPushEvent(CalenderData data)
        {
            var op = new Option();

            // 年の確認
            if (this.InputYear.Length == 0)
            {
                this.InputYear = DateTime.Now.Year.ToString();
            }

            this.inputMonth = 1;
            this.Date       = new DateTime(int.Parse(this.InputYear), this.InputMonth, 1);
            data.Date       = this.Date;
            data.InputDate  = this.Date;
            var frame = new MainFrame();

            frame.UserContorol(data, op);
            frame.Show();
        }
Пример #5
0
        /// <summary>
        /// VMを作成するmethod
        /// </summary>
        /// <param name="data">カレンダーデータクラス</param>
        /// <param name="op">オプションクラス</param>
        public void CreateControl(CalenderData data, Option op)
        {
            this.data  = data;
            this.op    = op;
            this.calVm = new OneCalenderPageControlViewModel();
            this.somVm = new SomeCalenderWindowViewModel();
            var vmList = new List <OneCalenderPageControlViewModel>();

            for (var i = 0; i < 12; i++)
            {
                this.calVm = new OneCalenderPageControlViewModel();
                this.calVm.SetOneCalender(this.data, this.op);

                // FlicrApi 今回は使用しない(処理に時間がかかる、画像の大きさが指定できない為)
                // var imgApi = new ImgAPI();
                // this.calVm.Entity.ImgUrl = imgApi.GetImg();
                vmList.Add(this.calVm);
            }

            // 画像のパスを入れる処理
            vmList[0].Img  = "Resources/January.jpg";
            vmList[1].Img  = "Resources/February.jpg";
            vmList[2].Img  = "Resources/March.jpg";
            vmList[3].Img  = "Resources/April.jpg";
            vmList[4].Img  = "Resources/May.jpg";
            vmList[5].Img  = "Resources/June.jpg";
            vmList[6].Img  = "Resources/July.jpg";
            vmList[7].Img  = "Resources/August.jpg";
            vmList[8].Img  = "Resources/September.jpg";
            vmList[9].Img  = "Resources/October.jpg";
            vmList[10].Img = "Resources/November.jpg";
            vmList[11].Img = "Resources/December.jpg";

            this.data.Date = this.data.InputDate;
            this.calVm.Vms = vmList;
            this.somVm.SetSomeCalender(this.data, this.op);
            this.CreatePage(this.calVm, this.somVm);
        }
Пример #6
0
 /// <summary>
 /// VMを動かすメソッド
 /// </summary>
 /// <param name="data">カレンダーデータクラス</param>
 /// <param name="op">オプションクラス</param>
 public void UserContorol(CalenderData data, Option op)
 {
     this.data = data;
     this.op   = op;
     ((MainFrameViewModel)this.DataContext).CreateControl(data, op);
 }
 /// <summary>
 /// カレンダー情報を初めて作るときの処理
 /// </summary>
 /// <param name="data">カレンダーデータクラス</param>
 /// <param name="op">オプションクラス</param>
 public void CalenderEntitysNew(CalenderData data, Option op)
 {
     this.CalenderEntitys = new ObservableCollection <CalenderCreateEntity>();
     this.SetSomeCalender(data, op);
 }
Пример #8
0
        /// <summary>
        /// 検索ボタンが押下されたときのイベント
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">イベントデータの情報</param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            CalenderData data = new CalenderData();

            this.vm.SearchButtonPushEvent(data);
        }
Пример #9
0
        /// <summary>
        /// カレンダーを1つ作成するメソッド
        /// </summary>
        /// <param name="calData">カレンダーデータクラス</param>
        /// <param name="paramOption">オプションクラス</param>
        /// <returns>CalenderEntity カレンダーの情報</returns>
        protected CalenderCreateEntity SetCalender(CalenderData calData, Option paramOption)
        {
            // 日付データの作成
            this.entity         = new CalenderCreateEntity();
            this.sunColorNumber = 0;
            this.satColorNumber = 6;

            calData.LastDay();
            calData.FastDateCreate();
            this.entity.Date        = calData.Date;
            this.entity.StringMonth = calData.Date.Month.ToString();
            this.entity.StringYear  = calData.Date.Year.ToString();
            this.option             = paramOption;

            var col = this.DateSwitch(this.option.IsDatePrintChange, calData.FastDate);

            var row = 0;

            this.DaysCreate(this.entity, calData, col, row, this.option);

            // 曜日の作成
            var dateCol = 0;
            var sun     = new WeekTitleSun()
            {
                Col = dateCol,
            };

            this.entity.CalenderWeekItems.Add(sun);
            dateCol++;

            var mon = new WeekTitleMon()
            {
                Col = dateCol,
            };

            this.entity.CalenderWeekItems.Add(mon);
            dateCol++;

            var tue = new WeekTitleTue()
            {
                Col = dateCol,
            };

            this.entity.CalenderWeekItems.Add(tue);
            dateCol++;

            var wen = new WeekTitleWen()
            {
                Col = dateCol,
            };

            this.entity.CalenderWeekItems.Add(wen);
            dateCol++;

            var thu = new WeekTitleThu()
            {
                Col = dateCol,
            };

            this.entity.CalenderWeekItems.Add(thu);
            dateCol++;

            var fri = new WeekTitleFri()
            {
                Col = dateCol,
            };

            this.entity.CalenderWeekItems.Add(fri);
            dateCol++;

            var sat = new WeekTitleSat()
            {
                Col = dateCol,
            };

            this.entity.CalenderWeekItems.Add(sat);

            return(this.entity);
        }