public NetServiceDocumentControl(NetServiceDocument document)
        {
            InitializeComponent();
            if (components == null)
            {
                components = new Container();
            }

            _serviceControl = (Control)Activator.CreateInstance(GetControlTypeForDocument(document), document);
            _readOnlyControl = _serviceControl as IReadOnlyControl;
            panelSettings.Controls.Add(_serviceControl);
            _serviceControl.Dock = DockStyle.Fill;
            _document = document;
            packetLogControl.LogName = _document.Name;
            packetLogControl.ReadOnly = !PacketLogMutable;
            packetLogControl.SetPackets(_document.Packets);
            metaEditorControl.Meta = _document.GlobalMeta;
            networkHistoryControl.SetDocument(_document);
            _defaultGraph = "Default";
            _fileLogs = new Dictionary<Guid, FileRedirectLogEntry>();
            Disposed += new EventHandler(NetServiceControl_Disposed);
            credentialsEditorControl.SetCredentials(_document.Credentials);

            PacketLogControlConfig config = document.GetProperty(PACKETLOG_CONFIG) as PacketLogControlConfig;

            if (config != null)
            {
                packetLogControl.Config = config;
            }

            Text = _document.Name;
            UpdateNetgraphs();

            comboBoxNetgraph.SelectedItem = null;

            foreach (object item in comboBoxNetgraph.Items)
            {
                NetGraphDocument doc = item as NetGraphDocument;
                if (doc == _document.NetGraph)
                {
                    comboBoxNetgraph.SelectedItem = item;
                    break;
                }
            }
        }
Exemple #2
0
        public NetServiceDocumentControl(NetServiceDocument document)
        {
            InitializeComponent();
            if (components == null)
            {
                components = new Container();
            }

            _serviceControl  = (Control)Activator.CreateInstance(GetControlTypeForDocument(document), document);
            _readOnlyControl = _serviceControl as IReadOnlyControl;
            panelSettings.Controls.Add(_serviceControl);
            _serviceControl.Dock      = DockStyle.Fill;
            _document                 = document;
            packetLogControl.LogName  = _document.Name;
            packetLogControl.ReadOnly = !PacketLogMutable;
            packetLogControl.SetPackets(_document.Packets);
            metaEditorControl.Meta = _document.GlobalMeta;
            networkHistoryControl.SetDocument(_document);
            _defaultGraph = "Default";
            _fileLogs     = new Dictionary <Guid, FileRedirectLogEntry>();
            Disposed     += new EventHandler(NetServiceControl_Disposed);
            credentialsEditorControl.SetCredentials(_document.Credentials);

            PacketLogControlConfig config = document.GetProperty(PACKETLOG_CONFIG) as PacketLogControlConfig;

            if (config != null)
            {
                packetLogControl.Config = config;
            }

            Text = _document.Name;
            UpdateNetgraphs();

            comboBoxNetgraph.SelectedItem = null;

            foreach (object item in comboBoxNetgraph.Items)
            {
                NetGraphDocument doc = item as NetGraphDocument;
                if (doc == _document.NetGraph)
                {
                    comboBoxNetgraph.SelectedItem = item;
                    break;
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// ÉèÖÃ״̬
        /// </summary>
        /// <param name="control"></param>
        /// <param name="state"></param>
        /// <param name="readOnlyWhenView"></param>
        public static void SetState(IReadOnlyControl control, StateType state, bool readOnlyWhenView)
        {
            switch (state)
            {
            case StateType.None:
                control.ReadOnly = readOnlyWhenView;
                break;

            case StateType.View:
                control.ReadOnly = readOnlyWhenView;
                break;

            case StateType.Add:
                control.ReadOnly = !readOnlyWhenView;
                break;

            case StateType.Edit:
                control.ReadOnly = !readOnlyWhenView;
                break;

            default:
                throw new NotSupportedException("Invalid State");
            }
        }
Exemple #4
0
 /// <summary>
 /// ÉèÖÃ״̬
 /// </summary>
 /// <param name="control"></param>
 /// <param name="state"></param>
 public static void SetState(IReadOnlyControl control, StateType state)
 {
     SetState(control, state, true);
 }