private void showLowMedHigh() { // EMPTY INSTANCES ARE FOR DEFAULT USE ONLY ! ! ! Exhibition DEFAULT_EXHIBITION = new Exhibition(); Exhibit DEFAULT_EXHIBIT = new Exhibit(); this.comboBox2.Items.Clear(); this.comboBox2.Items.Add("niedrig"); // Low this.comboBox2.Items.Add("normal"); // Medium this.comboBox2.Items.Add("hoch"); // High switch (this.setting) { case Setting.None: break; case Setting.UserPosition: break; case Setting.BackgroundImage: break; case Setting.Overview: break; case Setting.Threshold: this.comboBox2.SelectedIndex = detLessIsMore(DEFAULT_EXHIBITION.getThreshold(), this.exhibition.getThreshold()); break; case Setting.SelectionTime: this.comboBox2.SelectedIndex = detLessIsLess(DEFAULT_EXHIBITION.getSelectionTime(), this.exhibition.getSelectionTime()); break; case Setting.LockTime: this.comboBox2.SelectedIndex = detLessIsLess(DEFAULT_EXHIBITION.getLockTime(), this.exhibition.getLockTime()); break; case Setting.SlideTime: this.comboBox2.SelectedIndex = detLessIsLess(DEFAULT_EXHIBITION.getSlideTime(), this.exhibition.getSlideTime()); break; case Setting.KernelSize: this.comboBox2.SelectedIndex = detLessIsLess(DEFAULT_EXHIBIT.getKernelSize(), this.TMP_EXHIBIT.getKernelSize()); break; case Setting.KernelWeight: this.comboBox2.SelectedIndex = detLessIsLess(DEFAULT_EXHIBIT.getKernelWeight(), this.TMP_EXHIBIT.getKernelWeight()); break; case Setting.Position: break; default: break; } this.comboBox2.Visibility = Visibility.Visible; this.button2.Visibility = Visibility.Hidden; }
public void saveExhibition(Exhibition exhibition) { this.exhibitionFolder = exhibition.getPath().Substring(0, (exhibition.getPath().LastIndexOf('.'))); // Find the exhibition's folder including the exhibition's name at the end XmlWriter exhibitionWriter = XmlWriter.Create(exhibition.getPath(), this.xmlWriterSettings); // Create XmlWriter for file's path exhibitionWriter.WriteStartDocument(); // Start writing the file //<Exhibition> exhibitionWriter.WriteStartElement("Exhibition"); exhibitionWriter.WriteAttributeString("Name", exhibition.getName()); exhibitionWriter.WriteAttributeString("Path", exhibition.getPath()); if (exhibition.getBackgroundImage().Key != null) exhibitionWriter.WriteAttributeString("BackgroundImage", exhibition.getBackgroundImage().Key); if (exhibition.getOverview().Key != null) exhibitionWriter.WriteAttributeString("Overview", exhibition.getOverview().Key); exhibitionWriter.WriteAttributeString("UserPosition", exhibition.getUserPosition().ToString().Replace(',', '.').Replace(';', ' ')); exhibitionWriter.WriteAttributeString("Threshold", exhibition.getThreshold().ToString().Replace(',', '.')); exhibitionWriter.WriteAttributeString("SelectionTime", exhibition.getSelectionTime().ToString()); exhibitionWriter.WriteAttributeString("LockTime", exhibition.getLockTime().ToString()); exhibitionWriter.WriteAttributeString("SlideTime", exhibition.getSlideTime().ToString()); saveExhibitionPlane(exhibition.getExhibitionPlane()); //<ExhibitionPlane> exhibitionWriter.WriteStartElement("ExhibitionPlane"); exhibitionWriter.WriteAttributeString("Path", this.exhibitionFolder + "_Plane.xml"); exhibitionWriter.WriteEndElement(); //</ExhibitionPlane> if (exhibition.getExhibits() != null) // There are exhibits in the exhibition { //<Exhibits> exhibitionWriter.WriteStartElement("Exhibits"); foreach (Exhibit exhibit in exhibition.getExhibits()) { if (exhibit.getPath() == null) // No Path yet exhibit.setPath(this.exhibitionFolder + "_" + exhibit.getName() + ".xml"); saveExhibit(exhibit); //<Exhibit> exhibitionWriter.WriteStartElement("Exhibit"); exhibitionWriter.WriteAttributeString("Name", exhibit.getName()); exhibitionWriter.WriteAttributeString("Path", exhibit.getPath()); exhibitionWriter.WriteEndElement(); //</Exhibit> } exhibitionWriter.WriteEndElement(); //</Exhibits> } exhibitionWriter.WriteEndElement(); //</Exhibition> exhibitionWriter.WriteEndDocument(); // Stop writing the file exhibitionWriter.Close(); // Close the file }
private void setAttribute() { // EMPTY INSTANCES ARE FOR DEFAULT USE ONLY ! ! ! Exhibition DEFAULT_EXHIBITION = new Exhibition(); Exhibit DEFAULT_EXHIBIT = new Exhibit(); double factor = 1.0; if (this.comboBox2.SelectedIndex == 0) //Low { factor = this.LOW; } else if (this.comboBox2.SelectedIndex == 2) //High { factor = this.HIGH; } switch (this.setting) { case Setting.Threshold: if (factor != 1.0) this.exhibition.setThreshold(DEFAULT_EXHIBITION.getThreshold() * ((this.LOW + this.HIGH) - factor)); else this.exhibition.setThreshold(DEFAULT_EXHIBITION.getThreshold()); break; case Setting.SelectionTime: if (factor != 1.0) this.exhibition.setSelectionTime((int)(DEFAULT_EXHIBITION.getSelectionTime() * factor)); else this.exhibition.setSelectionTime(DEFAULT_EXHIBITION.getSelectionTime()); break; case Setting.LockTime: if (factor != 1.0) this.exhibition.setLockTime((int)(DEFAULT_EXHIBITION.getLockTime() * factor)); else this.exhibition.setLockTime(DEFAULT_EXHIBITION.getLockTime()); break; case Setting.SlideTime: if (factor != 1.0) this.exhibition.setSlideTime((int)(DEFAULT_EXHIBITION.getSlideTime() * factor)); else this.exhibition.setSlideTime(DEFAULT_EXHIBITION.getSlideTime()); break; case Setting.KernelSize: if (factor != 1.0) this.TMP_EXHIBIT.setKernelSize(DEFAULT_EXHIBIT.getKernelSize() * factor); else this.TMP_EXHIBIT.setKernelSize(DEFAULT_EXHIBIT.getKernelSize()); break; case Setting.KernelWeight: if (factor != 1.0) this.TMP_EXHIBIT.setKernelWeight(DEFAULT_EXHIBIT.getKernelWeight() * factor); else this.TMP_EXHIBIT.setKernelWeight(DEFAULT_EXHIBIT.getKernelWeight()); break; default: break; } }