public DialogResult ShowDialog(Solver solver) { Solver_ = solver; if (!Solver_.Timetable.RecomputeSolutions) return DialogResult.OK; base.ShowDialog(); return (Result_ == SolverResult.Complete ? DialogResult.OK : DialogResult.Cancel); }
public Solver(Timetable timetable, Solver other) { Timetable_ = timetable; this.Comparer_ = other.Comparer_.Clone(); this.Filters_ = new List<Solver.Filter>(other.Filters_); this.Solutions_ = new List<Solution>(Solutions_); this.MaxResults_ = other.MaxResults_; // other variables are initiated during solving }
public Solver.Filter ShowDialog(Solver.Filter filter) { if (filter == null) { Filter_ = null; Text = "Add Filter"; btnRevert.Enabled = false; } else { Filter_ = filter.DeepCopy(); Text = "Edit Filter"; btnRevert.Enabled = true; } LoadFromFilter(); DialogResult result = base.ShowDialog(); if (result == DialogResult.OK) return Filter_; return null; }
public Solver.Criteria ShowDialog(Solver.Criteria criteria) { if (criteria == null) { Criteria_ = null; Text = "Add Criteria"; btnRevert.Enabled = false; } else { Criteria_ = criteria.DeepCopy(); Text = "Edit Criteria"; btnRevert.Enabled = true; } LoadFromCriteria(); DialogResult result = base.ShowDialog(); if (result == DialogResult.OK) return Criteria_; return null; }
public FormMain() { Timetable_ = null; Solver_ = new Solver(null); InitializeComponent(); DefaultSize_ = Size; // do anchoring here to make form design easier tableLayoutPanel2.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; timetableControl1.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; tableLayoutPanel1.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; //tableLayoutPanel1.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; Export_.Width = 800; Export_.Height = 600; Export_.ShowAll = false; Export_.ShowDays = true; Export_.ShowGrayArea = false; Export_.ShowLocation = true; Export_.ShowText = true; Export_.ShowTimes = true; Export_.Grayscale = false; SaveDialogXML_.AddExtension = true; SaveDialogXML_.CheckFileExists = false; SaveDialogXML_.OverwritePrompt = true; SaveDialogXML_.Title = "Save Timetable"; SaveDialogXML_.Filter = "XML File (*.xml)|*.xml"; OpenDialogXML_.Multiselect = false; OpenDialogXML_.AddExtension = true; OpenDialogXML_.CheckFileExists = true; OpenDialogXML_.ShowReadOnly = false; OpenDialogXML_.Title = "Load Timetable"; OpenDialogXML_.Filter = "XML File (*.xml)|*.xml"; SaveDialogRaster_.AddExtension = true; SaveDialogRaster_.CheckFileExists = false; SaveDialogRaster_.OverwritePrompt = true; SaveDialogRaster_.Title = "Save Image"; SaveDialogRaster_.Filter = "PNG Image (*.png)|*.png|JPEG Image (*.jpg, *.jpeg)|*.jpg;*.jpeg|GIF Image (*.gif)|*.gif"; SaveDialogVector_.AddExtension = true; SaveDialogVector_.CheckFileExists = false; SaveDialogVector_.OverwritePrompt = true; SaveDialogVector_.Title = "Save Image"; SaveDialogVector_.Filter = "Enhanced Metafile (*.emf)|*.emf"; SaveDialogWallpaper_.AddExtension = true; SaveDialogWallpaper_.CheckFileExists = false; SaveDialogWallpaper_.OverwritePrompt = true; SaveDialogWallpaper_.Title = "Save Image"; SaveDialogWallpaper_.Filter = "Bitmap Image (*.bmp)|*.bmp"; SaveDialogWallpaper_.FileName = "wallpaper"; //pageSetupDialog1.PageSettings = printDocument1.DefaultPageSettings; pageSetupDialog.PageSettings.Landscape = true; pageSetupDialog.PageSettings.Margins = new Margins(10 * 1000 / 254, 10 * 1000 / 254, 10 * 1000 / 254, 10 * 1000 / 254); FitToScreen(); EnableButtons(false); UpdateSettings(); }
/*public Timetable ShallowCopy() { Timetable t = new Timetable(); t.SubjectList.AddRange(this.SubjectList); t.TypeList.AddRange(this.TypeList); t.StreamList.AddRange(this.StreamList); t.ClassList.AddRange(this.ClassList); }*/ // construct a new timetable object with enough information to render a preview public Timetable PreviewSolution(Solver.Solution solution) { Timetable t = new Timetable(); for (int i = 0; i < StreamList.Count; i++) { Stream stream = new Stream(StreamList[i]); if (solution.Streams.Contains(StreamList[i])) stream.Selected = true; t.StreamList.Add(stream); stream.Classes.Clear(); stream.Incompatible.Clear(); stream.Equivalent.Clear(); for (int j = 0; j < StreamList[i].Classes.Count; j++) { Session session = new Session(StreamList[i].Classes[j]); session.Stream = stream; stream.Classes.Add(session); t.ClassList.Add(session); } } t.UnavailableList = this.UnavailableList; return t; }
public bool LoadSolution(Solver.Solution solution) { bool result = true; foreach (Stream stream in solution.Streams) { // attempt to add it, return false if failed if (!SelectStream(stream)) result = false; } Update(); return result; }
private void LoadLists(Solver solver) { LoadLists(solver.Comparer.Criteria, solver.Filters); }
public DialogResult ShowDialog(Solver solver) { Solver_ = solver; return base.ShowDialog(); }
public DialogResult ShowDialog(Solver solver) { Solver_ = solver; return(base.ShowDialog()); }