/// <summary> /// This is called when the template has been bound to the control /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); ElementViewer = (ItemViewer)GetTemplateChild(ElementViewerName); ElementSelectedColor = (ColorItem)GetTemplateChild(ElementSelectedColorName); ElementAdd = (Button)GetTemplateChild(ElementAddName); ElementCustom = (StackPanel)GetTemplateChild(ElementCustomName); ElementViewer.ItemSelected += new ItemViewerEventHandler(ElementViewer_ItemSelected); ElementAdd.Click += new RoutedEventHandler(ElementAdd_Click); foreach (ColorItem item in _pending) { ElementViewer.Add(item); } Set(Custom.ToArray(), true); _pending.Clear(); _dropDown = (DropDown)ElementRoot; _dropDown.OpenPosition = OpenPosition; _dropDown.LostFocus += new RoutedEventHandler(ColorSelector_LostFocus); SetSelected(_selected); }
public Form1() { ElementViewer ElementViewer1 = new ElementViewer(); this.Controls.Add(ElementViewer1); this.Text = ElementViewer1.Text; this.Size = new Size(700, 550); }
/// <summary> /// Clears all colors from the selector /// </summary> public void Clear() { _pending.Clear(); if (ElementViewer != null) { ElementViewer.Clear(); } }
private void AddColor(ColorItem item) { if (ElementViewer != null) { ElementViewer.Add(item); } else { _pending.Add(item); } }
private void ResultsListBox_MouseDoubleClick(object sender, MouseEventArgs e) { if (resultsListBox.SelectedItem == null) { return; } Element selectedElement = resultsWithId[resultsListBox.SelectedItem.ToString()]; ElementViewer ev = new ElementViewer(selectedElement.Copy(), null, null); ev.Show(); }
private void resultsListBox_MouseDoubleClick(object sender, MouseEventArgs e) { if (resultsListBox.SelectedItem == null) { return; } if (Utilities.elementExists(resultsListBox.SelectedItem.ToString())) { ElementViewer ev = new ElementViewer(results[resultsListBox.SelectedItem.ToString()], null); ev.Show(); } }
private void CreateBaseElementButton_click(object sender, EventArgs e) { Element baseElement = new Element() { aspects = new Dictionary <string, int>() { { "summoned", 1 }, { "follower", 1 } }, lifetime = 60 }; MessageBox.Show("The fields with red labels are required.", "Required Values"); ElementViewer ev = new ElementViewer(baseElement, BaseElement_Assign, ElementType.Generator, null); ev.Show(); }
/// <summary> /// The semesterViewer method will instantiate, generate, and open a ElementViewer /// Form to display the contents of a specified semester object. /// </summary> /// <param name="semester"></param> private void semesterViewer(Semester semester) { // elements list List <String> elements = new List <String>(); //add all the semester elements to a list of strings elements.Add("Year: " + semester.Year); elements.Add("Term: " + semester.Term.ToString()); elements.Add("Minimum Credits: " + semester.MinCredits); elements.Add("Maximum Credits: " + semester.MaxCredits); elements.Add("Overloadable: " + semester.IsOverloadable.ToString()); //open a new elment viewer this.SuspendLayout(); ElementViewer semesterDetails = new ElementViewer(ref elements, semester.SemesterReference); semesterDetails.ShowDialog(); }
private void InspectPreButton_Click(object sender, EventArgs e) { ElementViewer ev = new ElementViewer(PreSummon, null, null); ev.Show(); }
private void inspectBaseButton_Click(object sender, EventArgs e) { ElementViewer ev = new ElementViewer(baseSummon, null); ev.Show(); }
private void createBaseElementButton_click(object sender, EventArgs e) { ElementViewer ev = new ElementViewer(new Element(), baseElement_Assign); ev.Show(); }
// Viewers -------------------------------------------------------------------------- /// <summary> /// The courseViewer method will instantiate, generate, and open a ElementViewer /// Form to display the contents of a specified course object. /// </summary> /// <param name="course"></param> private void courseViewer(Course course) { // elements list List <String> elements = new List <string>(); //get dependencies String dependencies = ""; foreach (Course dependency in course.dependencies) { dependencies += dependency.courseReference + ", "; } dependencies = dependencies.Trim(' ', ','); //get copendencies String copendencies = ""; foreach (Course copendency in course.copendencies) { copendencies += copendency.courseReference + ", "; } copendencies = copendencies.Trim(' ', ','); //get valid terms String terms = ""; foreach (TermEnums term in course.validTerms) { terms += term.ToString() + ", "; } terms = terms.Trim(' ', ','); //add all the courses elements to a list of strings elements.Add("Course Name: " + course.courseName); elements.Add("Course Description: " + course.courseDescription); elements.Add("Course Prefix: " + course.coursePrefix); elements.Add("Course ID: " + course.courseID); elements.Add("Credit hours: " + course.credits); elements.Add("Dependencies: " + dependencies); elements.Add("Copendencies: " + copendencies); elements.Add("Valid Terms: " + terms); // print additional course details elements.Add("Additional details: "); if (course.courseDetails.UndergraduateLevel) { elements.Add("-Course Level: " + "Undergraduate"); } else { elements.Add("-Course Level: " + "Graduate"); } if (course.courseDetails.CreditsRequired.HasValue) { elements.Add("-Required taken Credits: " + course.courseDetails.CreditsRequired); } if (course.courseDetails.YearBase.HasValue) { elements.Add("-Year Rotation Base: " + course.courseDetails.YearBase); elements.Add("-Year Rotation Multiplier: " + course.courseDetails.YearMultiple); } if (!course.courseDetails.RequiredStanding.Equals(Objects.Standing.FRESHMAN)) { elements.Add("-Required standing level: " + course.courseDetails.RequiredStanding.ToString()); } if (course.courseDetails.GeneralElective) { elements.Add("-Fullfills general elective requirements"); } if (course.courseDetails.DegreeElective) { elements.Add("-Fullfills degree elective requirements"); } if (course.courseDetails.DualCredit) { elements.Add("-Fullfills dual credit"); } //open a new element viewer this.SuspendLayout(); ElementViewer courseDetails = new ElementViewer(ref elements, course.courseReference); courseDetails.ShowDialog(); }