Ejemplo n.º 1
0
        /// <summary>編集するSeasonsオブジェクトを設定する</summary>
        /// <param name="seasons">編集するSeasonsオブジェクト</param>
        public void SetSeasons(Seasons seasons)
        {
            //編集中のseasonsオブジェクトがあればイベント通知を解除
            if (this.seasons != null)
            {
                this.seasons.NameChangeEvent -= new Seasons.NameChangeEventHandler(seasons_NameChangeEvent);
                this.seasons.SeasonAddEvent -= new Seasons.SeasonAddEventHandler(seasons_SeasonAddEvent);
                this.seasons.SeasonChangeEvent -= new Seasons.SeasonChangeEventHandler(seasons_SeasonChangeEvent);
                this.seasons.SeasonRemoveEvent -= new Seasons.SeasonRemoveEventHandler(seasons_SeasonRemoveEvent);
            }
            //編集中のseasonsオブジェクトを更新
            this.seasons = seasons;

            //Seasonsオブジェクトのイベント通知を受ける
            seasons.NameChangeEvent += new Seasons.NameChangeEventHandler(seasons_NameChangeEvent);
            seasons.SeasonAddEvent += new Seasons.SeasonAddEventHandler(seasons_SeasonAddEvent);
            seasons.SeasonChangeEvent += new Seasons.SeasonChangeEventHandler(seasons_SeasonChangeEvent);
            seasons.SeasonRemoveEvent += new Seasons.SeasonRemoveEventHandler(seasons_SeasonRemoveEvent);

            //コントロール削除時にイベント通知を解除
            this.Disposed += delegate(object sender, EventArgs e) {
                seasons.NameChangeEvent -= new Seasons.NameChangeEventHandler(seasons_NameChangeEvent);
                seasons.SeasonAddEvent -= new Seasons.SeasonAddEventHandler(seasons_SeasonAddEvent);
                seasons.SeasonChangeEvent -= new Seasons.SeasonChangeEventHandler(seasons_SeasonChangeEvent);
                seasons.SeasonRemoveEvent -= new Seasons.SeasonRemoveEventHandler(seasons_SeasonRemoveEvent);
            };

            //リストボックスを初期化
            lbxSeasons.Items.Clear();
            for (int i = 0; i < seasons.Count; i++) lbxSeasons.Items.Add(seasons.GetSeasonName(i));
            //季節が一つの場合は削除ボタンを操作不能にする
            if (lbxSeasons.Items.Count <= 1) btnRemove.Enabled = false;
            //一つ目の季節を選択
            if (0 < lbxSeasons.Items.Count) lbxSeasons.SelectedIndex = 0;

            //Seasonsの名称を設定
            initializing = true;
            tbxSeasonsName.Text = seasons.Name;
            initializing = false;
        }
Ejemplo n.º 2
0
        public static void MakeScheduler()
        {
            //スケジュールを作成
            //FC有り
            CTSchedule fc = new CTSchedule();
            fc.FCStartTemperature = 13;
            fc.OperatingMode = CTSchedule.Mode.SwitchWithWBTemp;
            fc.OutletWaterTemperatureFC = 16;
            fc.OutletWaterTemperature = 32;

            //FC無し
            CTSchedule noFc = new CTSchedule();
            fc.OperatingMode = CTSchedule.Mode.NoFreeCooling;
            fc.OutletWaterTemperature = 32;

            //期間構造(四季)を作成
            ITermStructure terms = new Seasons(Seasons.PredefinedSeasons.FourSeasons);
            //最上層のスケジューラを作成
            Scheduler<CTSchedule> ctScheduler = new Scheduler<CTSchedule>(terms);

            //期間構造(平日・週末)を作成
            terms = new Days(Days.PredefinedDays.WeekDayAndWeekEnd);
            //冬季用スケジューラを作成
            Scheduler<CTSchedule> winterSC = new Scheduler<CTSchedule>(terms);
            //平日のみFC有り
            winterSC.SetSchedule("週末", noFc);
            winterSC.SetSchedule("平日", fc);

            //冬季の平日を階層構造で表現
            ctScheduler.SetScheduler("冬", winterSC);

            //その他の季節は曜日を問わずFC無し
            ctScheduler.SetSchedule("春", noFc);
            ctScheduler.SetSchedule("夏", noFc);
            ctScheduler.SetSchedule("秋", noFc);
        }