private void LoadState(object sender, EventArgs e) { AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, @"..\..\persist"); this.tabbedMDIManager.LoadTabGroupStates(serializer); SendMessageToStatusBar("TabGroupStates loaded"); }
/// <summary> /// To load the layout 1 /// </summary> private void BarItem13_Click(object sender, EventArgs e) { // AppStateSerializer serializer = new AppStateSerializer(SerializeMode.BinaryFile, "MyFile"); AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, @"..\\..\\Layout1"); this.dockingManager1.LoadDockState(serializer); }
private void btn_serialize_Click(object sender, EventArgs e) { autoComplete1.AutoSerialize = true; AppStateSerializer aser = new AppStateSerializer(SerializeMode.XMLFile, "info.xml"); switch (formatToSerialize) { case "XML": autoComplete1.CategoryName = "XmlData"; aser = new AppStateSerializer(SerializeMode.XMLFile, "info.xml"); this.autoComplete1.SaveCurrentState(aser); break; case "Binary": autoComplete1.CategoryName = "BinaryData"; aser = new AppStateSerializer(SerializeMode.BinaryFile, "binaryfile"); this.autoComplete1.SaveCurrentState(aser); aser.PersistNow(); break; case "Memory Stream": autoComplete1.CategoryName = "MemoryStream"; aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, ms); this.autoComplete1.SaveCurrentState(aser); aser.PersistNow(); break; } MessageBoxAdv.ThemeName = "Office2019Colorful"; string message = "AutoComplete data are saved successfully."; MessageBoxAdv.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btn_deserialize_Click(object sender, EventArgs e) { AppStateSerializer aser = new AppStateSerializer(SerializeMode.XMLFile, "info.xml"); switch (formatToSerialize) { case "XML": autoComplete1.CategoryName = "XmlData"; aser = new AppStateSerializer(SerializeMode.XMLFile, "info.xml"); this.autoComplete1.LoadCurrentState(aser); break; case "Binary": autoComplete1.CategoryName = "BinaryData"; aser = new AppStateSerializer(SerializeMode.BinaryFile, "binaryfile.bin"); this.autoComplete1.LoadCurrentState(aser); break; case "Memory Stream": autoComplete1.CategoryName = "MemoryStream"; MemoryStream ms1 = new MemoryStream(ms.ToArray()); ms1.Position = 0; aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, ms1); this.autoComplete1.LoadCurrentState(aser); break; } MessageBoxAdv.ThemeName = "Office2019Colorful"; string message = "Data are loaded successfully in AutoComplete."; MessageBoxAdv.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> /// Save As XMLFile /// </summary> private void BarItem18_Click(object sender, EventArgs e) { // To save AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, "Dock1"); this.dockingManager1.SaveDockState(serializer); serializer.PersistNow(); }
/// <summary> /// Load from BinaryFile /// </summary> private void BarItem20_Click(object sender, EventArgs e) { // To Load AppStateSerializer serializer = new AppStateSerializer(SerializeMode.BinaryFile, "myfile"); this.dockingManager1.LoadDockState(serializer); }
/// <summary> /// Save As IsolatedStorage /// </summary> private void BarItem16_Click(object sender, EventArgs e) { AppStateSerializer serializer = new AppStateSerializer(SerializeMode.IsolatedStorage, "myfile"); this.dockingManager1.SaveDockState(serializer); serializer.PersistNow(); }
/// <summary> /// Save As BinaryFile /// </summary> private void BarItem17_Click(object sender, EventArgs e) { // To Save AppStateSerializer serializer = new AppStateSerializer(SerializeMode.BinaryFile, "myfile"); this.dockingManager1.SaveDockState(serializer); serializer.PersistNow(); }
private static string GetPath(this AppStateSerializer serializer) { string path = serializer.SerializationPath as string ?? string.Empty; if (!string.IsNullOrWhiteSpace(path)) { path += ".xml"; } return(path); }
private void SaveState() { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Title = "Save state to XML file"; saveFileDialog1.CheckPathExists = true; saveFileDialog1.DefaultExt = "xml"; saveFileDialog1.Filter = "XML-File | *.xml"; saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { AppStateSerializer app = new AppStateSerializer(SerializeMode.XMLFile, saveFileDialog1.FileName); this.wordribbon.SaveState(app); app.PersistNow(); } }
public Form1() { InitializeComponent(); this.MinimumSize = this.Size; try { System.Drawing.Icon ico = new System.Drawing.Icon(GetIconFile(@"common\Images\Grid\Icon\sfgrid1.ico")); this.Icon = ico; } catch { } //adding TabbedMDI Manager this.tabbedMDIManager = new Syncfusion.Windows.Forms.Tools.TabbedMDIManager(); this.tabbedMDIManager.AttachedTo = this; this.tabbedMDIManager.DropDownButtonVisible = true; this.tabbedMDIManager.ImageSize = new System.Drawing.Size(16, 16); this.tabbedMDIManager.NeedUpdateHostedForm = false; this.tabbedMDIManager.TabStyle = typeof(Syncfusion.Windows.Forms.Tools.TabRendererOffice2016Colorful); this.tabbedMDIManager.BeforeDropDownPopup += new Syncfusion.Windows.Forms.Tools.DropDownPopupEventHandler(this.BeforePopup); this.tabbedMDIManager.TabControlAdded += new Syncfusion.Windows.Forms.Tools.TabbedMDITabControlEventHandler(this.tabbedMDIManager_TabControlAdded); // Trigger when right clicking on the tabs. this.tabbedMDIManager.ContextMenuItem.BeforePopup += new CancelEventHandler(ContextMenuItem_BeforePopup); this.propertyGrid1.SelectedObject = (object)this.tabbedMDIManager; this.FormClosing += new FormClosingEventHandler(Form1_FormClosing); this.NewDocClick(this, EventArgs.Empty); this.NewDocClick(this, EventArgs.Empty); this.NewDocClick(this, EventArgs.Empty); this.NewDocClick(this, EventArgs.Empty); // Turn on MDI Tabbed Documents mode. // Call this after loading the mdi children to restore their previous state. this.TabbedMDIOn = true; this.tabbedMDIManager.ContextMenuItem.Items.Add(this.closeAllContextMenuItem); this.tabbedMDIManager.ContextMenuItem.BeginGroupAt(closeAllContextMenuItem); this.tabbedMDIManager.ContextMenuItem.Items.Add(this.newDocumentContextMenuItem); this.tabbedMDIManager.ThemeName = "Office2019Colorful"; if (File.Exists(@"..\..\persist.xml")) { AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, @"..\..\persist"); this.tabbedMDIManager.LoadTabGroupStates(serializer); SendMessageToStatusBar("TabGroupStates loaded"); } }
private void LoadState() { OpenFileDialog openFileDialog1 = new OpenFileDialog { InitialDirectory = @"D:\", Title = "Load state from XML file", CheckFileExists = true, CheckPathExists = true, DefaultExt = "xml", Filter = "XML-File | *.xml", FilterIndex = 2, RestoreDirectory = true, ReadOnlyChecked = true, ShowReadOnly = true }; if (openFileDialog1.ShowDialog() == DialogResult.OK) { AppStateSerializer app = new AppStateSerializer(SerializeMode.XMLFile, openFileDialog1.FileName); this.wordribbon.LoadState(app); } }
private void PresentationDesignerForm_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing && !this.presentationRemoved) { if (/*PresentationController.Instance.PresentationLocked && */PresentationController.Instance.PresentationChanged) { switch (MessageBoxExt.Show(Properties.Resources.SavePresentation, Properties.Resources.Confirmation, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { case DialogResult.Yes: e.Cancel = !SavePresentation(); break; case DialogResult.Cancel: e.Cancel = true; return; case DialogResult.No: break; //{ // if (PresentationController.Instance.PresentationLocked && !StartedFromPlayer) // UnlockPresentation(false); // PresentationController.Instance.UnlockAllSlides(false); //} //return; } } if (e.Cancel) return; } if (e.CloseReason != CloseReason.None) { bool isOk = true; if (!this.presentationRemoved) { //снятие блокировки if (PresentationController.Instance.PresentationLocked && !DesignerClient.Instance.IsStandAlone) { isOk = StartedFromPlayer ? true : UnlockPresentation(); } if (isOk) { if (PresentationController.Instance.SomeSlidesLocked && !DesignerClient.Instance.IsStandAlone) { try { //unlock in silent mode PresentationController.Instance.UnlockAllSlides(false); } catch { //MessageBox.Show("Во время разблокирови сцен произошла ошибка: " + ex.Message); isOk = false; } } } } //if (isOk) { PresentationController.Instance.OnChanged -= PresentationChanged; PresentationController.Instance.OnPresentationLockChanged -= Instance_OnPresentationLockChanged; PresentationController.Instance.OnPresentationRemoved -= Instance_OnPresentationRemoved; PresentationController.Instance.OnPresentationLockedExternally -= Instance_OnPresentationLockedExternally; PresentationController.Instance.OnPresentationUnlockedExternally -= Instance_OnPresentationUnlockedExternally; UndoService.Instance.OnHistoryChanged -= new HistoryChanged(OnHistoryChanged); SlideGraphController.Instance.Dispose(); SourcesController.Instance.Dispose(); LayoutController.Instance.OnShownStatusChanged -= Instance_OnShownStatusChanged; LayoutController.Instance.Dispose(); DisplayController.Instance.Dispose(); PresentationController.Instance.Dispose(); } string path = Application.StartupPath + "\\dockstate.xml"; if (File.Exists(path)) File.Delete(path); AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, path); this.dockingManager.SaveDockState(serializer); serializer.PersistNow(); } }
private void PresentationDesignerForm_Load(object sender, EventArgs e) { AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, Application.StartupPath + "\\dockstate.xml"); this.dockingManager.LoadDockState(serializer); if (m_SlideToNavigate != -1) { this.slideDiagram.GoToSlide(m_SlideToNavigate); } lockMenuButton.Enabled = !StartedFromPlayer; lockSlideMenuButton.Enabled = !StartedFromPlayer; if (StartedFromPlayer) { SlideGraphController.Instance.LockSlides(); } if (JustCreatedPresentation) slideDiagram.LockSlide(); }
private void barItem10_Click(object sender, EventArgs e) { AppStateSerializer.InitializeSingleton(SerializeMode.XMLFile, "Dock1"); this.dockingManager1.SaveDockState(); }
private void barItem2_Click(object sender, EventArgs e) { AppStateSerializer serializer = new AppStateSerializer(SerializeMode.IsolatedStorage, "myfile"); this.dockingManager1.LoadDockState(serializer); }