Exemple #1
0
        /// <summary>
        /// Save state of controls (size, location, dock etc.)
        /// </summary>
        /// <param name="info"></param>
        public void SaveState(SerializationInfoEx info)
        {
            // Save panels.
            SavePanelState(info, panelTop);
            SavePanelState(info, panelBottom);
            SavePanelState(info, panelLeft);
            SavePanelState(info, panelRight);
            SavePanelState(info, panelCenter);

            // Save draggable controls.
            DockStyle[] values = (DockStyle[])Enum.GetValues(typeof(DockStyle));
            foreach (DockStyle style in values)
            {
                List <SerializationInfoEx> infos = new List <SerializationInfoEx>();
                foreach (DragControl control in GetAreaControls(style))
                {
                    //if (control.ControlContained == null)
                    //{// Skip empty drag controls.
                    //    continue;
                    //}

                    SerializationInfoEx controlInfo = new SerializationInfoEx();
                    control.SaveState(controlInfo);
                    infos.Add(controlInfo);
                }
                info.AddValue(style.ToString() + "Infos", infos);
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="info"></param>
 public void SaveState(SerializationInfoEx info)
 {
     info.AddValue("guid", _guid);
     info.AddValue("location", Location);
     info.AddValue("text", Text);
     info.AddValue("name", Name);
     info.AddValue("dock", Dock);
     info.AddValue("size", Size);
     info.AddValue("showDragStrip", _showDragStrip);
 }
Exemple #3
0
        /// <summary>
        /// Save state.
        /// </summary>
        /// <param name="state"></param>
        public void SaveState(SerializationInfoEx state)
        {
            if (_stringFilter != null)
            {
                state.AddValue("_stringFilter", _stringFilter);
            }

            if (_stringInputFilter != null)
            {
                state.AddValue("_stringInputFilter", _stringInputFilter);
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="info"></param>
 public void RestoreState(SerializationInfoEx info)
 {
     Guid     = info.GetValue <Guid>("guid");
     Location = info.GetValue <Point>("location");
     Text     = info.GetString("text");
     Name     = info.GetString("name");
     Dock     = info.GetValue <DockStyle>("dock");
     Size     = info.GetValue <Size>("size");
     if (info.ContainsValue("showDragStrip"))
     {
         ShowDragStrip = info.GetBoolean("showDragStrip");
     }
 }
Exemple #5
0
        /// <summary>
        /// Restore state of the controls.
        /// </summary>
        /// <param name="info"></param>
        /// <param name="panel"></param>
        void RestorePanelState(SerializationInfoEx info, Panel panel)
        {
            if (info.ContainsValue(panel.Name + ".Width"))
            {
                panel.Width = info.GetInt32(panel.Name + ".Width");
            }

            if (info.ContainsValue(panel.Name + ".Height"))
            {
                panel.Height = info.GetInt32(panel.Name + ".Height");
            }

            if (info.ContainsValue(panel.Name + ".Visible"))
            {
                panel.Visible = info.GetBoolean(panel.Name + ".Visible");
            }
        }
Exemple #6
0
        /// <summary>
        /// Restore state of controls. Controls are created and left invisible untill assigned.
        /// </summary>
        /// <param name="info"></param>
        public void RestoreState(SerializationInfoEx info)
        {
            // Clear off any existing drag control from any area.
            DockStyle[] values = (DockStyle[])Enum.GetValues(typeof(DockStyle));
            foreach (DockStyle style in values)
            {
                foreach (DragControl control in GetAreaControls(style))
                {
                    RemoveDragControl(control);
                }
            }

            // Restore draggable controls.
            foreach (DockStyle style in values)
            {
                string fieldName = style.ToString() + "Infos";
                if (info.ContainsValue(fieldName) == false)
                {
                    continue;
                }
                List <SerializationInfoEx> infos = info.GetValue <List <SerializationInfoEx> >(fieldName);
                foreach (SerializationInfoEx controlInfo in infos)
                {
                    DragControl control = new DragControl();
                    control.RestoreState(controlInfo);
                    control.Visible = false;
                    AddDragControl(control);

                    if (style != DockStyle.None)
                    {
                        DockControl(control, style);
                    }
                }
            }

            // Restore panes.
            RestorePanelState(info, panelTop);
            RestorePanelState(info, panelBottom);
            RestorePanelState(info, panelLeft);
            RestorePanelState(info, panelRight);
            RestorePanelState(info, panelCenter);
        }
        /// <summary>
        /// Call this to persist state data to controls. Controls contain their own settings (partial).
        /// </summary>
        public void SaveState(SerializationInfoEx info)
        {
            // Remove the checked control from drag controls, since it does not need to be stored.
            ChangeCheckedControl(null);

            // Clean of any leftover controls before persisting.
            foreach (DragControl control in GeneralHelper.EnumerableToArray <DragControl>(dragContainerControl.DragControls))
            {
                if (control.ControlContained == null && control != _checkedControlContainer)
                {
                    dragContainerControl.RemoveDragControl(control);
                }
            }

            // Also lets store the _checkedControlContainer
            if (_checkedControlContainer != null)
            {
                info.AddValue("combinedContainerControl.CheckedControlContainerGuid", _checkedControlContainer.Guid);
            }

            info.AddValue("combinedContainerControl.ShowComponentsTitles", toolStripButtonTitlesText.Checked);

            dragContainerControl.SaveState(info);

            foreach (ToolStripButton component in _tabbedButtonsControls.Keys)
            {
                PersistControlData(_tabbedButtonsControls[component], component);
            }

            foreach (CombinedHostingForm form in _floatingFormsControls.Keys)
            {
                PersistControlData(_floatingFormsControls[form], form);
            }

            foreach (DragControl dragControl in dragContainerControl.DragControls)
            {
                if (dragControl.ControlContained != null)
                {
                    PersistControlData((CommonBaseControl)dragControl.ControlContained, dragControl);
                }
            }
        }
Exemple #8
0
        /// <summary>
        /// Load state.
        /// </summary>
        /// <param name="state"></param>
        public void LoadState(SerializationInfoEx state)
        {
            if (state.ContainsValue("_stringFilter"))
            {
                StringTracerFilter stringFilter = state.GetValue <StringTracerFilter>("_stringFilter");
                if (_stringFilter != null)
                {
                    _stringFilter.CopyDataFrom(stringFilter);
                }
            }

            if (state.ContainsValue("_stringInputFilter"))
            {
                StringTracerFilter stringInputFilter = state.GetValue <StringTracerFilter>("_stringInputFilter");
                if (_stringInputFilter != null)
                {
                    _stringInputFilter.CopyDataFrom(stringInputFilter);
                }
            }

            WinFormsHelper.DirectOrManagedInvoke(this, UpdateFiltersUI);
        }
        /// <summary>
        ///
        /// </summary>
        public void RestoreState(SerializationInfoEx info)
        {
            dragContainerControl.ClearControls();

            dragContainerControl.RestoreState(info);

            //dragContainerControl.ClearControls();

            if (info.ContainsValue("combinedContainerControl.ShowComponentsTitles"))
            {
                toolStripButtonTitlesText.Checked = info.GetBoolean("combinedContainerControl.ShowComponentsTitles");
            }

            // Establish the CheckedControlContainer
            if (info.ContainsValue("combinedContainerControl.CheckedControlContainerGuid"))
            {
                Guid guid = info.GetValue <Guid>("combinedContainerControl.CheckedControlContainerGuid");
                _checkedControlContainer = dragContainerControl.GetDragControlByGuid(guid);
                if (_checkedControlContainer != null)
                {
                    _checkedControlContainer.ShowDragStrip = false;
                }
            }
        }
Exemple #10
0
 /// <summary>
 /// Save the state of the controls - placement, size etc.
 /// </summary>
 /// <param name="info"></param>
 /// <param name="panel"></param>
 void SavePanelState(SerializationInfoEx info, Panel panel)
 {
     info.AddValue(panel.Name + ".Width", panel.Width);
     info.AddValue(panel.Name + ".Height", panel.Height);
     info.AddValue(panel.Name + ".Visible", panel.Visible);
 }