コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="orderInfo"></param>
        public void RestoreState(SerializationInfoEx info)
        {
            ListEx <DynamicCustomObject> dynamicObjects = info.GetValue <ListEx <DynamicCustomObject> >("CustomObjectManager::_dynamicCustomObjects");
            ListEx <CustomObject>        staticObjects  = info.GetValue <ListEx <CustomObject> >("CustomObjectManager::_staticCustomObjects");

            foreach (DynamicCustomObject dynamicObject in dynamicObjects)
            {
                this.Add(dynamicObject);
            }

            foreach (CustomObject customObject in staticObjects)
            {
                this.Add(customObject);
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        public void RestoreState(SerializationInfoEx info)
        {
            Clear();

            lock (this)
            {
                foreach (ChartPane pane in GeneralHelper.EnumerableToList <ChartPane>(_panes))
                {
                    if (pane is SlaveChartPane)
                    {
                        this.RemoveSlavePane((SlaveChartPane)pane);
                    }
                }

                this.Name = info.GetString("Name");

                this.hScrollBar.Visible = info.GetBoolean("hScrollBar.Visible");
                this.vScrollBar.Visible = info.GetBoolean("vScrollBar.Visible");
                toolStripButtonShowScrollbars.Checked = this.hScrollBar.Visible;

                List <SerializationInfoEx> infos = info.GetValue <List <SerializationInfoEx> >("panesStates");
                for (int i = 0; i < infos.Count; i++)
                {
                    if (i == 0)
                    {
                        MasterPane.RestoreState(infos[0], true);
                    }
                    else
                    {
                        SlaveChartPane pane = CreateSlavePane("", SlaveChartPane.MasterPaneSynchronizationModeEnum.XAxis, 100);
                        pane.RestoreState(infos[i], true);
                    }
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 
        /// </summary>
        public void RestoreState(SerializationInfoEx info)
        {
            Clear();

            lock (this)
            {
                foreach (ChartPane pane in GeneralHelper.EnumerableToList<ChartPane>(_panes))
                {
                    if (pane is SlaveChartPane)
                    {
                        this.RemoveSlavePane((SlaveChartPane)pane);
                    }
                }

                this.Name = info.GetString("Name");

                this.hScrollBar.Visible = info.GetBoolean("hScrollBar.Visible");
                this.vScrollBar.Visible = info.GetBoolean("vScrollBar.Visible");
                toolStripButtonShowScrollbars.Checked = this.hScrollBar.Visible;

                List<SerializationInfoEx> infos = info.GetValue<List<SerializationInfoEx>>("panesStates");
                for (int i = 0; i < infos.Count; i++)
                {
                    if (i == 0)
                    {
                        MasterPane.RestoreState(infos[0], true);
                    }
                    else
                    {
                        SlaveChartPane pane = CreateSlavePane("", SlaveChartPane.MasterPaneSynchronizationModeEnum.XAxis, 100);
                        pane.RestoreState(infos[i], true);
                    }
                }
            }
        }
コード例 #4
0
        public void RestoreState(SerializationInfoEx info, bool restoreCustomObjects)
        {
            this.Name = info.GetString("Name");
            this.Height = info.GetInt32("Height");

            _stateId = info.GetValue<Guid>("_stateId");
            _titleFont = info.GetValue<Font>("_titleFont");

            _titleFontBrush = info.GetValue<Brush>("_titleFontBrush");
            _fill = info.GetValue<Brush>("_fill");
            _axisLabelsFont = info.GetValue<Font>("_axisLabelsFont");
            _xAxisLabelsFontBrush = info.GetValue<Brush>("_xAxisLabelsFontBrush");
            _yAxisLabelsPosition = info.GetValue<YAxisLabelPosition>("_yAxisLabelsPosition");
            _yAxisLabelsFontBrush = info.GetValue<Brush>("_yAxisLabelsFontBrush");

            _xAxisLabelsFormat = info.GetString("_xAxisLabelsFormat");
            _yAxisLabelsFormat = info.GetString("_yAxisLabelsFormat");

            _labelsFont = info.GetValue<Font>("_labelsFont");
            _labelsFontBrush = info.GetValue<Brush>("_labelsFontBrush");
            _labelsFill = info.GetValue<Brush>("_labelsFill");

            _labelsTopMargin = info.GetSingle("_labelsTopMargin");
            _labelsMargin = info.GetSingle("_labelsMargin");

            _showSeriesLabels = info.GetBoolean("_showSeriesLabels");
            _showClippingRectangle = info.GetBoolean("_showClippingRectangle");
            _unitUnificationOptimizationEnabled = info.GetBoolean("_unitUnificationOptimizationEnabled");

            _smoothingMode = info.GetValue<SmoothingMode>("_smoothingMode");
            _defaultAbsoluteSelectionMargin = info.GetSingle("_defaultAbsoluteSelectionMargin");

            _scrollMode = info.GetValue<ScrollModeEnum>("_scrollMode");
            _rightMouseButtonSelectionMode = info.GetValue<SelectionModeEnum>("_rightMouseButtonSelectionMode");

            _selectionPen = info.GetValue<Pen>("_selectionPen");
            _selectionFill = info.GetValue<Brush>("_selectionFill");

            _additionalDrawingSpaceAreaMarginLeft = info.GetInt32("_additionalDrawingSpaceAreaMarginLeft");
            _additionalDrawingSpaceAreaMarginRight = info.GetInt32("_additionalDrawingSpaceAreaMarginRight");

            _actualDrawingSpaceAreaMarginLeft = info.GetInt32("_actualDrawingSpaceAreaMarginLeft");
            _actualDrawingSpaceAreaMarginTop = info.GetInt32("_actualDrawingSpaceAreaMarginTop");
            _actualDrawingSpaceAreaMarginRight = info.GetInt32("_actualDrawingSpaceAreaMarginRight");
            _actualDrawingSpaceAreaMarginBottom = info.GetInt32("_actualDrawingSpaceAreaMarginBottom");

            _actualDrawingSpaceAreaBorderPen = info.GetValue<Pen>("_actualDrawingSpaceAreaBorderPen");
            _actualDrawingSpaceAreaFill = info.GetValue<Brush>("_actualDrawingSpaceAreaFill");
            _limitedView = info.GetBoolean("_limitedView");

            _seriesItemWidth = info.GetSingle("_seriesItemWidth");
            _seriesItemMargin = info.GetSingle("_seriesItemMargin");

            if (restoreCustomObjects && info.GetBoolean("customObjectsSaved"))
            {// Restore custom objects.
                _customObjectsManager.RestoreState(info);
            }
            else
            {// New clear custom objects.
                _customObjectsManager.Clear();
            }

            _actualSpaceGrid = info.GetValue<ChartGrid>("_actualSpaceGrid");
            _drawingSpaceGrid = info.GetValue<ChartGrid>("_drawingSpaceGrid");
            _chartName = info.GetString("_chartName");
            _appearanceScheme = info.GetValue<AppearanceSchemeEnum>("_appearanceScheme");

            _autoScrollToEnd = info.GetBoolean("_autoScrollToEnd");

            if (info.ContainsValue("_maximumXZoom"))
            {
                _maximumXZoom = info.GetSingle("_maximumXZoom");
            }
            else
            {
                _maximumXZoom = null;
            }

            _xAxisLabelSpacing = info.GetSingle("_xAxisLabelSpacing");

            if (AppearanceSchemeChangedEvent != null)
            {
                AppearanceSchemeChangedEvent(this, _appearanceScheme);
            }
        }
コード例 #5
0
        /// <summary>
        /// The initialization of a platform consumes 2 main dataDelivery sources.
        /// The settings is used for primary, startup information (like where
        /// is the persistence DB file etc.) and the information inside the
        /// persistence is than on used to create components etc.
        /// </summary>
        public bool Initialize(PlatformSettings platformSettings)
        {
            TracerHelper.TraceEntry();

            SystemMonitor.CheckThrow(_settings == null, "Platform already initialized.");

            lock (this)
            {
                _settings = platformSettings;
                if (_persistenceHelper == null)
                {
                    _persistenceHelper = CreatePersistenceHelper(platformSettings);
                }
            }

            if (_persistenceHelper == null)
            {
                return(false);
            }

            LoadModules(_settings);

            if (_persistenceHelper.Count <Platform>(new MatchExpression("Name", this.Name)) == 0)
            {// This is a new platform.
                lock (this)
                {
                    _guid = Guid.NewGuid();
                }

                if (_persistenceHelper.Insert <Platform>(this, null) == false)
                {
                    SystemMonitor.Error("Failed to persist new platform [" + this.Name + "]");
                    return(false);
                }
            }
            else
            {// This is existing.
                // Now try to load self from persistance storage.
                bool selectionResult = _persistenceHelper.SelectScalar <Platform>(this, new MatchExpression("Name", this.Name));

                if (selectionResult == false)
                {// Failed to load self from DB.
                    return(false);
                }
            }

            lock (this)
            {
                if (_serializationData.ContainsValue("diagnosticsMode"))
                {
                    _settings.DiagnosticsMode = _serializationData.GetBoolean("diagnosticsMode");
                }

                if (_serializationData.ContainsValue("uiSerializationInfo"))
                {
                    // The main serialization dataDelivery stores the UI orderInfo.
                    _uiSerializationInfo = _serializationData.GetValue <SerializationInfoEx>("uiSerializationInfo");
                }

                if (_serializationData.ContainsValue("componentSpecificSerializationInfo"))
                {
                    // The main serialization dataDelivery stores the UI orderInfo.
                    _componentSpecificSerializationInfo = _serializationData.GetValue <SerializationInfoEx>("componentSpecificSerializationInfo");
                }
            }

            //_server = new Arbiter.TransportIntegrationServer(_platformUri);
            //Arbiter.AddClient(_server);

            GeneralHelper.FireAndForget(delegate()
            {// LoadFromFile components.
             // Registering of components is better done outside the lock,
             // since components may launch requests to platform at initializations.

                _isLoading = true;

                // Components are stored in the PlatformComponents database, they are being serialized and the entire object is
                // persisted in the DB, as well as the type information for it and a reference to the platform instance it belongs to.
                List <long> failedSerializationsIds = new List <long>();
                List <PlatformComponent> components = PersistenceHelper.SelectSerializedType <PlatformComponent>(
                    new MatchExpression("PlatformId", this.Id), "Data", null, failedSerializationsIds);

                SortedList <int, List <PlatformComponent> > componentsByLevel = GetComponentsByLevel(components);

                GatherMandatoryComponents(componentsByLevel);

                foreach (int level in componentsByLevel.Keys)
                {// Register lower level components first.
                    foreach (PlatformComponent component in componentsByLevel[level])
                    {
                        if (DoRegisterComponent(component, true) == false &&
                            component.Id.HasValue && ComponentDeserializationFailedEvent != null)
                        {
                            ComponentDeserializationFailedEvent(component.Id.Value, component.GetType().Name);
                        }
                    }
                }

                // Handle failed deserializations.
                foreach (int id in failedSerializationsIds)
                {
                    string typeName = "Unknown";

                    try
                    {// Extract the type of this entry.
                        List <object[]> result = _persistenceHelper.SelectColumns <PlatformComponent>(
                            new MatchExpression("Id", id), new string[] { "Type" }, 1);

                        Type type = Type.GetType(result[0][0].ToString());

                        if (type != null)
                        {
                            typeName = type.Name;
                        }
                    }
                    catch (Exception ex)
                    {
                        SystemMonitor.Error("Failed to extract type information [" + ex.Message + "].");
                    }

                    if (ComponentDeserializationFailedEvent != null)
                    {
                        ComponentDeserializationFailedEvent(id, typeName);
                    }
                }

                _isLoading = false;
            });

            return(true);
        }
コード例 #6
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);
        }
コード例 #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="orderInfo"></param>
        public void RestoreState(SerializationInfoEx info)
        {
            ListEx<DynamicCustomObject> dynamicObjects = info.GetValue<ListEx<DynamicCustomObject>>("CustomObjectManager::_dynamicCustomObjects");
            ListEx<CustomObject> staticObjects = info.GetValue<ListEx<CustomObject>>("CustomObjectManager::_staticCustomObjects");

            foreach (DynamicCustomObject dynamicObject in dynamicObjects)
            {
                this.Add(dynamicObject);
            }

            foreach (CustomObject customObject in staticObjects)
            {
                this.Add(customObject);
            }
        }
コード例 #8
0
 /// <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");
     }
 }
コード例 #9
0
        /// <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;
                }
            }
        }
コード例 #10
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);
        }