/// <summary> /// Initializes a new instance of the <see cref="EnvConfiguratorDialog"/> class. /// </summary> /// <param name="environment"> /// The environment. /// </param> /// <param name="executionParam"> /// The execution param. /// </param> /// <exception cref="ArgumentException"> /// </exception> internal EnvConfiguratorDialog(MonitorEnvironment environment, ExecutionParam executionParam) : this() { if (environment == null) { throw new ArgumentException("Environment cannot be null"); } if (environment.Logger == null) { throw new ArgumentException("Environment logger cannot be null"); } if (environment.ConfigStore == null) { throw new ArgumentException("Environment config store cannot be null"); } if (executionParam.ConfigHandler == null) { throw new ArgumentException("Execution param config store cannot be null"); } this._logger = environment.Logger; this._typeResolver = new TypeResolver(this._logger); this._executionParam = executionParam.ReflectionDeepClone(this._logger); this.Height -= this.pnlTop.Height; this._env = environment.ReflectionDeepClone(this._logger); #if DEBUG this._env.Id = Guid.NewGuid().ToString(); #endif this.InitializeData(); }
/// <summary> /// Initializes a new instance of the <see cref="SchedulerForm"/> class. /// </summary> /// <param name="defaultParam"> /// The default param. /// </param> /// <param name="logger"> /// The logger. /// </param> public SchedulerForm(ExecutionParam defaultParam, ILogger logger) { this.InitializeComponent(); this.InitializeImageList(); this._logger = logger; this._scheduler = new SchedulerManager(this._logger); this.Text = AppUtil.ProductName + " " + this.Text; this.loadProgress.ControlItem.ContainerControl = this; this.loadProgress.ControlItem.ShowInTaskbar = false; this.statusStrip.Items.Add(this.loadProgress); this._defaultParam = defaultParam.ReflectionDeepClone(logger); if (this._defaultParam.OperationMode != OperationMode.GetFareAndSave && this._defaultParam.OperationMode != OperationMode.LiveMonitor) { this._defaultParam.OperationMode = OperationMode.GetFareAndSave; } this.loadProgress.VisibleChanged += this.LoadProgress_VisibleChanged; }
/// <summary> /// The initialize. /// </summary> /// <param name="param"> /// The param. /// </param> private void Initialize(ExecutionParam param) { // Update the view based on Execution parameters this._executionParam = param.ReflectionDeepClone(AppContext.Logger); this.txtDeparture.SelectedAirport = param.Departure; this.txtDestination.SelectedAirport = param.Destination; if (param.MinStayDuration == int.MinValue || param.MinStayDuration == int.MaxValue) { param.MinStayDuration = Settings.Default.DefaultDurationMin; } if (param.MaxStayDuration == int.MinValue || param.MaxStayDuration == int.MaxValue) { param.MaxStayDuration = Settings.Default.DefaultDurationMax; } if (param.DepartureDate.IsUndefined() || param.DepartureDate < DateTime.Now) { param.DepartureDate = DateTime.Now.AddDays(1); } if (param.ReturnDate.IsUndefined() || param.ReturnDate < param.DepartureDate) { param.ReturnDate = param.DepartureDate.AddDays(param.MaxStayDuration); } this.departureDatePicker.MinDate = this.returnDatePicker.MinDate = DateTime.Now.Date; this.departureDatePicker.Value = param.DepartureDate; this.returnDatePicker.Value = param.ReturnDate; this.numDepartDateRangePlus.Value = param.DepartureDateRange.Plus; this.numDepartDateRangeMinus.Value = param.DepartureDateRange.Minus; this.numReturnDateRangePlus.Value = param.ReturnDateRange.Plus; this.numReturnDateRangeMinus.Value = param.ReturnDateRange.Minus; this.numMinDuration.Value = param.MinStayDuration; this.numMaxDuration.Value = param.MaxStayDuration; this.numPriceLimit.Value = param.PriceLimit > 0 ? param.PriceLimit : 1; this.loadProgress.ControlItem.ContainerControl = this; this.loadProgress.ControlItem.ShowInTaskbar = false; this.statusStrip.Items.Add(this.loadProgress); this.statusStrip.Items.Add(this.springLabelStrip); this.chkAutoFocusTabStrip.Control.Text = "Auto-focus completed tab"; this.chkAutoFocusTabStrip.Alignment = ToolStripItemAlignment.Right; this.statusStrip.Items.Add(this.chkAutoFocusTabStrip); this.chkAutoSyncStrip.Control.Text = "Auto-sync exported data"; this.chkAutoSyncStrip.Alignment = ToolStripItemAlignment.Right; this.chkAutoSyncStrip.ControlItem.DataBindings.Clear(); this.chkAutoSyncStrip.ControlItem.DataBindings.Add("Checked", this._executionParam, "AutoSync"); this.statusStrip.Items.Add(this.chkAutoSyncStrip); this.chkExitAfterDoneStrip.ControlItem.Text = "Exit after done"; this.chkExitAfterDoneStrip.ControlItem.DataBindings.Clear(); this.chkExitAfterDoneStrip.ControlItem.DataBindings.Add("Checked", this._executionParam, "ExitAfterDone"); this.chkExitAfterDoneStrip.Alignment = ToolStripItemAlignment.Right; this.statusStrip.Items.Add(this.chkExitAfterDoneStrip); foreach (ToolStripItem item in this.statusStrip.Items) { item.Margin = new Padding(3, 1, 3, 1); } this.UpdateViewForDuration(); this.ResizeStatusStrip(); }