/// <summary> /// This method returns the <see cref="CustomShuffling"/> that is /// defined in this dialog. /// </summary> /// <returns>The <see cref="CustomShuffling"/> that is /// defined in this dialog.</returns> private CustomShuffling GetShuffling() { CustomShuffling newShuffling = new CustomShuffling( this.selectedNodeID, this.chbShuffleSections.Checked, (int)this.nudCountSectionItemsInGroup.Value, this.chbShuffleGroups.Checked, this.chbShuffleInsideGroups.Checked); newShuffling.UseThisCustomShuffling = this.rdbEnableShuffling.Checked; return(newShuffling); }
/// <summary> /// This method populates the dialog with the given <see cref="CustomShuffling"/>. /// </summary> /// <param name="shuffling">The <see cref="CustomShuffling"/> /// that is designed in this dialog.</param> private void PopulateShuffling(CustomShuffling shuffling) { this.chbShuffleGroups.Checked = shuffling.ShuffleGroups; this.chbShuffleInsideGroups.Checked = shuffling.ShuffleGroupItems; this.chbShuffleSections.Checked = shuffling.ShuffleSectionItems; this.nudCountSectionItemsInGroup.Value = shuffling.NumItemsOfSectionInGroup; this.rdbEnableShuffling.Checked = shuffling.UseThisCustomShuffling; foreach (TreeNode node in this.trvSlideshow.Nodes) { if (node.Name == shuffling.ShuffleSectionsParentNodeID.ToString(CultureInfo.InvariantCulture)) { this.selectedNodeID = shuffling.ShuffleSectionsParentNodeID; this.txbParentNodeName.Text = node.Text; break; } } }
/// <summary> /// This method returns the <see cref="CustomShuffling"/> that is /// defined in this dialog. /// </summary> /// <returns>The <see cref="CustomShuffling"/> that is /// defined in this dialog.</returns> private CustomShuffling GetShuffling() { CustomShuffling newShuffling = new CustomShuffling( this.selectedNodeID, this.chbShuffleSections.Checked, (int)this.nudCountSectionItemsInGroup.Value, this.chbShuffleGroups.Checked, this.chbShuffleInsideGroups.Checked); newShuffling.UseThisCustomShuffling = this.rdbEnableShuffling.Checked; return newShuffling; }
/// <summary> /// This method populates the dialog with the given <see cref="CustomShuffling"/>. /// </summary> /// <param name="shuffling">The <see cref="CustomShuffling"/> /// that is designed in this dialog.</param> private void PopulateShuffling(CustomShuffling shuffling) { this.chbShuffleGroups.Checked = shuffling.ShuffleGroups; this.chbShuffleInsideGroups.Checked = shuffling.ShuffleGroupItems; this.chbShuffleSections.Checked = shuffling.ShuffleSectionItems; this.nudCountSectionItemsInGroup.Value = shuffling.NumItemsOfSectionInGroup; this.rdbEnableShuffling.Checked = shuffling.UseThisCustomShuffling; foreach (TreeNode node in this.trvSlideshow.Nodes) { if (node.Name == shuffling.ShuffleSectionsParentNodeID.ToString(CultureInfo.InvariantCulture)) { this.selectedNodeID = shuffling.ShuffleSectionsParentNodeID; this.txbParentNodeName.Text = node.Text; break; } } }
/// <summary> /// Initializes a new instance of the Slideshow class by cloneing the given <see cref="Slideshow"/> /// </summary> /// <param name="slideshow">A <see cref="Slideshow"/> to be cloned.</param> public Slideshow(Slideshow slideshow) { this.Name = slideshow.Name; this.Text = slideshow.Text; this.ImageKey = slideshow.ImageKey; this.shuffling = slideshow.Shuffling; foreach (SlideshowTreeNode node in slideshow.Nodes) { this.Nodes.Add((SlideshowTreeNode)node.Clone()); } }
/////////////////////////////////////////////////////////////////////////////// // Construction and Initializing methods // /////////////////////////////////////////////////////////////////////////////// #region CONSTRUCTION /// <summary> /// Initializes a new instance of the Slideshow class. /// </summary> public Slideshow() { this.Name = "-1"; this.Text = "Slideshow"; this.shuffling = new CustomShuffling(); }
/// <summary> /// This method is a custom deserialization with an <see cref="XmlSerializer"/> /// to read the contents of the <see cref="Slideshow"/> that /// are exposed in this override. It deserializes recursively. /// </summary> /// <param name="reader">The <see cref="XmlReader"/> to use.</param> /// <param name="node">The <see cref="SlideshowTreeNode"/> to deserialize.</param> public override void DeserializeNode(XmlReader reader, SlideshowTreeNode node) { var shuffleSerializer = new XmlSerializer(typeof(CustomShuffling)); // Check for Versions < Ogama 4.3 if (reader.Name == "SlideshowTreeNode") { base.DeserializeNode(reader, node); return; } reader.ReadStartElement("IsModified"); this.IsModified = reader.ReadContentAsBoolean(); reader.ReadEndElement(); if (reader.Name == "CustomShuffling") { this.shuffling = (CustomShuffling)shuffleSerializer.Deserialize(reader); } while ((reader.Name == "SlideshowTreeNode" && reader.NodeType == XmlNodeType.Element) || (reader.Name == "BrowserTreeNode" && reader.NodeType == XmlNodeType.Element)) { if (reader.Name == "SlideshowTreeNode") { var newNode = new SlideshowTreeNode(); newNode.DeserializeNode(reader, newNode); this.SetTreeNodeImageKey(newNode); node.Nodes.Add(newNode); } else if (reader.Name == "BrowserTreeNode") { var newNode = new BrowserTreeNode(); newNode.DeserializeNode(reader, newNode); this.SetTreeNodeImageKey(newNode); node.Nodes.Add(newNode); } } }