public void setExhibit(int index, Exhibit exhibit) { this.exhibits[index] = exhibit; // Replace old with new exhibit }
public void addExhibit(Exhibit exhibit) { this.exhibits.Add(exhibit); }
public void removeExhibit(Exhibit exhibit) { this.exhibits.Remove(exhibit); }
public Exhibit loadExhibit(string path) { Dictionary<string, BitmapImage> images = new Dictionary<string, BitmapImage>(); // Prepare Dictionary for storage of coming images XmlReader exhibitReader = XmlReader.Create(path); // Create XmlReader for file's path while (exhibitReader.Read()) { if (exhibitReader.NodeType == XmlNodeType.Element) { switch (exhibitReader.Name) { case "Exhibit": this.TMP_EXHIBIT = new Exhibit(); while (exhibitReader.MoveToNextAttribute()) { switch (exhibitReader.Name) { case "Name": this.TMP_EXHIBIT.setName(exhibitReader.Value); break; case "Path": this.TMP_EXHIBIT.setPath(exhibitReader.Value); break; case "KernelSize": this.TMP_EXHIBIT.setKernelSize(double.Parse(exhibitReader.Value)); break; case "KernelWeight": this.TMP_EXHIBIT.setKernelWeight(double.Parse(exhibitReader.Value)); break; case "Description": this.TMP_EXHIBIT.setDescription(exhibitReader.Value); break; default: break; } } break; case "Position": while (exhibitReader.MoveToNextAttribute()) { if (exhibitReader.Name == "Position") { this.TMP_EXHIBIT.setPosition(Point3D.Parse(exhibitReader.Value)); } } break; case "Images": // There are images in the exhibit break; case "Image": while (exhibitReader.MoveToNextAttribute()) { if (exhibitReader.Name == "Path") { KeyValuePair<string, BitmapImage> image = loadImage(exhibitReader.Value); images.Add(image.Key, image.Value); } } break; default: break; } } } this.TMP_EXHIBIT.setImages(images); exhibitReader.Close(); return this.TMP_EXHIBIT; }
private void selection() { Thread.Sleep(this.IMI_EXHIBITION.getSelectionTime()); // Wait for confirmation time to elapse if (this.presenting) // Other presentation allready running { stopPresentation(); // Abort running presentation } if (IMI_TARGET != 99) // Only for valid targets { this.TMP_EXHIBIT = this.IMI_EXHIBITION.getExhibit(this.IMI_TARGET); // Set current exhibit this.dataLogger.addEventToSession("Select Target", this.IMI_EXHIBITION.getExhibit(this.IMI_TARGET).getName(), this.users.Count, (int)this.IMI_ID); } this.contentLabel1 = this.TMP_EXHIBIT.getName(); // Set the current exhibit's name as headline this.contentLabel2 = this.TMP_EXHIBIT.getDescription(); // Set the current exhibit's description this.mode = Mode.Presentation; // Go to presentation mode startPresentation(); pauseSession(this.IMI_EXHIBITION.getLockTime()); stopSelectionTimer(); // Selection done := close this thread }
public void saveExhibit(Exhibit exhibit) { XmlWriter exhibitWriter = XmlWriter.Create(exhibit.getPath(), this.xmlWriterSettings); // Create XmlWriter for file's path exhibitWriter.WriteStartDocument(); // Start writing the file //<Exhibit> exhibitWriter.WriteStartElement("Exhibit"); exhibitWriter.WriteAttributeString("Name", exhibit.getName()); exhibitWriter.WriteAttributeString("Path", exhibit.getPath()); exhibitWriter.WriteAttributeString("KernelSize", exhibit.getKernelSize().ToString().Replace(',', '.')); exhibitWriter.WriteAttributeString("KernelWeight", exhibit.getKernelWeight().ToString()); if (exhibit.getDescription() != null) // The exhibit has a description { exhibitWriter.WriteAttributeString("Description", exhibit.getDescription()); } //<Position> exhibitWriter.WriteStartElement("Position"); exhibitWriter.WriteAttributeString("Position", exhibit.getPosition().ToString().Replace(',', '.').Replace(';', ' ')); exhibitWriter.WriteEndElement(); //</Position> if (exhibit.getImages() != null) // The exhibit has images { //<Images> exhibitWriter.WriteStartElement("Images"); foreach (KeyValuePair<string, BitmapImage> image in exhibit.getImages()) { //<Image> exhibitWriter.WriteStartElement("Image"); exhibitWriter.WriteAttributeString("Path", image.Key); exhibitWriter.WriteEndElement(); //</Image> } exhibitWriter.WriteEndElement(); //</Images> } exhibitWriter.WriteEndElement(); //</Exhibit> exhibitWriter.WriteEndDocument(); // Stop writing the file exhibitWriter.Close(); // Close the file }
private void button5_Click(object sender, RoutedEventArgs e) { switch (this.headline) { default: break; case Headline.Start: //"close the application" closeAllThreads(); break; case Headline.Exhibition: //"close the application" if (this.exhibition.getPath() == null) { if (this.saveConfigDialog.ShowDialog() == true) { this.exhibition.setPath(saveConfigDialog.FileName); } } this.fileHandler.saveExhibition(this.exhibition); closeAllThreads(); break; case Headline.LoadExhibit: //"hidden" break; case Headline.NewExhibit: //"hidden" break; case Headline.EditExhibit: //"editing done" this.TMP_EXHIBIT.setDescription(this.textBox1.Text); if (this.TMP_EXHIBIT_INDEX != -1) // Existing exhibit { this.exhibition.setExhibit(this.TMP_EXHIBIT_INDEX, this.TMP_EXHIBIT); this.fileHandler.saveExhibit(this.TMP_EXHIBIT); this.contentLabel1 = this.exhibition.getName().ToUpper(); this.contentButton4 = "Einstellungen"; this.contentButton5 = "schließen"; this.headline = Headline.Exhibition; updateLayout(); } else // New exhibit { if (this.saveConfigDialog.ShowDialog() == true) { this.TMP_EXHIBIT.setPath(this.saveConfigDialog.FileName); this.TMP_PATH = null; this.exhibition.addExhibit(this.TMP_EXHIBIT); this.fileHandler.saveExhibit(this.TMP_EXHIBIT); this.contentLabel1 = this.exhibition.getName().ToUpper(); this.contentButton4 = "Einstellungen"; this.contentButton5 = "schließen"; this.headline = Headline.Exhibition; updateLayout(); } } break; case Headline.ExhibitionPlane: //"hidden" break; case Headline.ExhibitionPlaneDef: //"start definition of exhibition plane" if (!this.calibrating) { startPlaneDefinition(); this.contentButton4 = "Abbruch"; this.contentButton5 = "Start"; this.button5.Visibility = Visibility.Hidden; updateButtons(); } break; case Headline.ExhibitionPlaneVal: //"start validation of exhibition plane" if (!this.calibrating) { startPlaneDefinition(); this.contentButton4 = "Abbruch"; this.button5.Visibility = Visibility.Hidden; updateButtons(); } break; case Headline.ExhibitionPlaneDone: //"abort validation of exhibition plane" stopTracking(); this.exhibition = new Exhibition(this.TMP_NAME, this.TMP_EXHIBITION_PLANE); MessageBox.Show("Bitte stellen Sie umgehend die Benutzerposition ein."); this.contentLabel1 = this.exhibition.getName().ToUpper(); this.contentButton4 = "Einstellungen"; this.contentButton5 = "schließen"; this.headline = Headline.Exhibition; updateLayout(); break; case Headline.NewName: //"safe name and continue to next view" if (this.exhibition == null) // New exhibition { this.TMP_NAME = this.textBox2.Text; this.contentLabel1 = this.TMP_NAME.ToUpper() + " - EBENENBESTIMMUNG"; this.contentLabel2 = this.INSTRUCTIONS_EXHIBITION_PLANE; this.contentButton1 = "laden"; this.contentButton2 = "bestimmen"; this.contentButton4 = "zurück"; this.contentButton5 = "OK"; this.headline = Headline.ExhibitionPlane; } else // New exhibit { startTracking(); this.TMP_NAME = this.textBox2.Text; this.contentLabel1 = this.TMP_NAME.ToUpper() + " - POSITIONSBESTIMMUNG"; this.contentLabel2 = this.INSTRUCTIONS_EXHIBIT; this.contentButton4 = "zurück"; this.contentButton5 = "Start"; this.headline = Headline.ExhibitDef; } updateLayout(); break; case Headline.ExhibitDef: //"start definition of an exhibit or the user position" if (!this.calibrating && this.setting == Setting.None) { startPositionDefinition(); this.contentButton4 = "Abbruch"; this.button5.Visibility = Visibility.Hidden; updateButtons(); } else if (!this.calibrating && this.setting == Setting.UserPosition) { startUserPositionDefinition(); this.contentButton4 = "Abbruch"; this.button5.Visibility = Visibility.Hidden; updateButtons(); } else if (!this.calibrating && this.setting == Setting.Position) { startPositionDefinition(); this.contentButton4 = "Abbruch"; this.button5.Visibility = Visibility.Hidden; updateButtons(); } break; case Headline.ExhibitVal: //"start validation of an exhibit or accept user position" if (!this.calibrating && this.setting == Setting.None) // Validation { startPositionDefinition(); this.contentButton4 = "Abbruch"; this.button5.Visibility = Visibility.Hidden; updateButtons(); } else if (!this.calibrating && this.setting == Setting.Position) { startPositionDefinition(); this.contentButton4 = "Abbruch"; this.button5.Visibility = Visibility.Hidden; updateButtons(); } else // Acceptance of user position { stopTracking(); this.contentLabel1 = this.exhibition.getName() + " - EINSTELLUNGEN"; this.contentButton5 = "OK"; this.headline = Headline.ExhibitionSettings; updateLayout(); } break; case Headline.ExhibitDone: //"abort validation of exhibition plane" if (this.setting == Setting.UserPosition) { //this.exhibition.setUserPosition SOMEHOW this.contentLabel1 = this.exhibition.getName() + " - EINSTELLUNGEN"; this.contentButton5 = "OK"; this.headline = Headline.ExhibitionSettings; } else if (this.setting == Setting.Position) { this.TMP_EXHIBIT.setPosition(this.geometryHandler.getCenter(this.TMP_POSITION, this.TMP_POSITION_2)); this.contentLabel1 = this.TMP_EXHIBIT.getName() + " - EINSTELLUNGEN"; this.headline = Headline.ExhibitSettings; } else //((int)this.setting == 0) //New Exhibit: Settings.None { Point3D position = this.geometryHandler.getCenter(this.TMP_POSITION, this.TMP_POSITION_2); this.TMP_EXHIBIT = new Exhibit(this.TMP_NAME, position); this.contentLabel1 = this.TMP_EXHIBIT.getName(); this.contentTextBox1 = this.TMP_EXHIBIT.getDescription(); this.headline = Headline.EditExhibit; } this.setting = Setting.None; updateLayout(); break; case Headline.ExhibitionSettings: //"safe and go back to exhibition" if (this.exhibition.getPath() != null) // Config-file already exists { this.fileHandler.saveExhibition(this.exhibition); } this.contentLabel1 = this.exhibition.getName().ToUpper(); this.contentButton4 = "Einstellungen"; this.contentButton5 = "schließen"; this.headline = Headline.Exhibition; this.setting = Setting.None; updateLayout(); break; case Headline.ExhibitSettings: //"go to exhibit" if (this.TMP_EXHIBIT.getPath() != null) // Config-file already exists { this.fileHandler.saveExhibit(this.TMP_EXHIBIT); } this.headline = Headline.EditExhibit; this.setting = Setting.None; updateLayout(); break; } }
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; }
private void button1_Click(object sender, RoutedEventArgs e) { switch (this.headline) { case Headline.Start: //"load existing exhibition" if (this.loadConfigDialog.ShowDialog() == true) // Temporary file path has been set { this.exhibition = this.fileHandler.loadExhibition(this.TMP_PATH); this.TMP_PATH = null; this.contentLabel1 = this.exhibition.getName().ToUpper(); this.contentButton4 = "Einstellungen"; this.contentButton5 = "schließen"; this.headline = Headline.Exhibition; updateLayout(); } break; case Headline.Exhibition: //"hidden" break; case Headline.LoadExhibit: //"edit exhibit" this.TMP_EXHIBIT = this.exhibition.getExhibit(this.TMP_EXHIBIT_INDEX); this.TMP_EXHIBIT_INDEX = this.comboBox1.SelectedIndex - 1; this.contentLabel1 = this.TMP_EXHIBIT.getName().ToUpper() + " - BEARBEITEN"; this.contentTextBox1 = this.TMP_EXHIBIT.getDescription(); this.headline = Headline.EditExhibit; updateLayout(); break; case Headline.NewExhibit: //"load existing exhibit" if (this.loadConfigDialog.ShowDialog() == true) // Temporary file path has been set { this.TMP_EXHIBIT = this.fileHandler.loadExhibit(this.TMP_PATH); this.TMP_PATH = null; this.exhibition.addExhibit(this.TMP_EXHIBIT); this.TMP_EXHIBIT_INDEX = this.exhibition.getExhibits().Count - 1; this.contentLabel1 = this.TMP_EXHIBIT.getName().ToUpper() + " - BEARBEITEN"; this.contentTextBox1 = this.TMP_EXHIBIT.getDescription(); this.headline = Headline.EditExhibit; updateLayout(); } else // Temporary file path hat not been set { } break; case Headline.EditExhibit: //"hidden" break; case Headline.ExhibitionPlane: //"load exisiting definition of the exhibition plane" if (this.loadConfigDialog.ShowDialog() == true) // Temporary file path has been set { this.TMP_EXHIBITION_PLANE = this.fileHandler.loadExhibitionPlane(this.TMP_PATH); this.TMP_PATH = null; this.exhibition = new Exhibition(this.TMP_NAME, this.TMP_EXHIBITION_PLANE); this.contentLabel1 = this.exhibition.getName().ToUpper(); this.contentButton4 = "Einstellungen"; this.contentButton5 = "schließen"; this.headline = Headline.Exhibition; updateLayout(); } break; case Headline.ExhibitionPlaneDef: //"hidden" break; case Headline.ExhibitionPlaneVal: //"hidden" break; case Headline.ExhibitionPlaneDone: //"hidden" break; case Headline.NewName: //"hidden" break; case Headline.ExhibitDef: //"hidden" break; case Headline.ExhibitVal: //"hidden" break; case Headline.ExhibitDone: //"hidden" break; case Headline.ExhibitionSettings: //"hidden" break; case Headline.ExhibitSettings: //"hidden" break; default: break; } }
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; } }