private void SaveStateButton_Click(object sender, EventArgs e) { string InstanceName; SaveForm save = new SaveForm(); save.ShowDialog(); InstanceName = save.getName(); save.Dispose(); MandelbrotData state = new MandelbrotData( InstanceName, this.MaximumIterations, this.ZoomScale, this.Greyscale.Checked, this.BlackAndWhite.Checked, this.MinimumXValue, this.MaximumXValue, this.MinimumYValue, this.MaximumYValue, Convert.ToInt32(this.ZExponentBox.Value), Convert.ToInt32(this.CExponentBox.Value) ); string XmlData = state.ToXml(); string XmlFilePath = @"C:\Users\" + this.ComputerUserName + "\\Documents\\Mandelbrot\\" + this.rName + "\\SavedStates\\" + InstanceName + ".xml"; File.WriteAllText(XmlFilePath, XmlData); }
public void RedoButton_Click(object sender, EventArgs e) { try { MandelbrotData data = RedoData.Pop(); IterationsTextbox.Text = Convert.ToString(data.GetIter()); ZoomScaleTextBox.Text = Convert.ToString(data.GetZoomScale()); Greyscale.Checked = data.GetGrey(); BlackAndWhite.Checked = data.GetBlackWhite(); this.MaximumXValue = data.GetXMax(); this.MinimumXValue = data.GetXMin(); this.MaximumYValue = data.GetYMax(); this.MinimumYValue = data.GetYMin(); XMinLabel.Text = Convert.ToString(this.MinimumXValue); XMaxLabel.Text = Convert.ToString(this.MaximumXValue); YMinLabel.Text = Convert.ToString(this.MinimumYValue); YMaxLabel.Text = Convert.ToString(this.MaximumYValue); this.ZExponentBox.Value = (int)data.GetZExponent(); this.CExponentBox.Value = (int)data.GetCExponent(); UndoData.Push(data); } catch (StackUnderflowException stackException) { MBOX(stackException.Message); } catch (Exception e2) { MessageBox.Show("Exception Trapped: " + e2.Message, "Error"); } }
public static object[] ToArray(MandelbrotData instance) { return(new object[11] { instance.InstanceName, instance.iter, instance.zoomScale, instance.grey, instance.blackWhite, instance.x_max, instance.x_min, instance.y_max, instance.y_min, instance.zPower, instance.cPower }); }
private void StateDropDown_SelectedIndexChanged(object sender, EventArgs e) { string filename = StateDropDown.Text + ".xml"; string XmlFilePath = @"C:\Users\" + this.ComputerUserName + "\\Documents\\Mandelbrot\\" + this.rName + "\\SavedStates\\" + filename; string XmlContents = File.ReadAllText(XmlFilePath); MandelbrotData FileData = XmlContents.FromXml <MandelbrotData>(); this.IterationsTextbox.Text = Convert.ToString(FileData.GetIter()); this.ZoomScaleTextBox.Text = Convert.ToString(FileData.GetZoomScale()); this.MaximumXValue = FileData.GetXMax(); this.MaximumYValue = FileData.GetYMax(); this.MinimumXValue = FileData.GetXMin(); this.MinimumYValue = FileData.GetYMin(); this.Greyscale.Checked = FileData.GetGrey(); this.BlackAndWhite.Checked = FileData.GetBlackWhite(); this.ZExponentBox.Value = Convert.ToDecimal(FileData.GetZExponent()); this.CExponentBox.Value = Convert.ToDecimal(FileData.GetCExponent()); }
public override string ToString() { return(String.Format("{0}, {1}, {2}. {3}, {4}, {5}, {6}, {7}, {8}, {9} {10}.", MandelbrotData.ToArray(this))); }