Esempio n. 1
0
        public AgentEditPage(Agent agent)
        {
            InitializeComponent();

            if (agent != null)
            {
                mAgent = agent;
                mOriginalPlatformType = mAgent.Platform;
                mOriginalDriverType   = mAgent.DriverType.ToString();

                App.ObjFieldBinding(AgentNameTextBox, TextBox.TextProperty, mAgent, Agent.Fields.Name);
                txtPlatformType.Text = mOriginalPlatformType.ToString();

                App.ObjFieldBinding(NotesTextBox, TextBox.TextProperty, mAgent, Agent.Fields.Notes);

                // Remote Agent config
                //App.ObjFieldBinding(HostTextBox, TextBox.TextProperty, mAgent, Agent.Fields.Host);
                //App.ObjFieldBinding(PortTextBox, TextBox.TextProperty, mAgent, Agent.Fields.Port);
                //App.ObjFieldBinding(RemoteCheckBox, CheckBox.IsCheckedProperty, mAgent, Agent.Fields.Remote);

                TagsViewer.Init(mAgent.Tags);

                SetDriverTypeCombo();
                App.ObjFieldBinding(driverTypeComboBox, ComboBox.TextProperty, mAgent, Agent.Fields.DriverType);

                driverTypeComboBox.SelectionChanged += driverTypeComboBox_SelectionChanged;

                DriverConfigFrmae.SetContent(new AgentDriverConfigPage(mAgent));
            }
        }
        public AgentEditPage(Agent agent)
        {
            InitializeComponent();

            if (agent != null)
            {
                mAgent = agent;

                xShowIDUC.Init(mAgent);
                GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xAgentNameTextBox, TextBox.TextProperty, mAgent, nameof(Agent.Name));
                GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xDescriptionTextBox, TextBox.TextProperty, mAgent, nameof(Agent.Notes));
                GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xAgentTypelbl, Label.ContentProperty, mAgent, nameof(Agent.AgentType));
                BindingHandler.ObjFieldBinding(xPublishcheckbox, CheckBox.IsCheckedProperty, mAgent, nameof(RepositoryItemBase.Publish));
                TagsViewer.Init(mAgent.Tags);

                if (mAgent.AgentType == eAgentType.Driver)
                {
                    mOriginalPlatformType = mAgent.Platform;
                    mOriginalDriverType   = mAgent.DriverType.ToString();

                    xPlatformTxtBox.Text = mOriginalPlatformType.ToString();
                    SetDriverInformation();
                    GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xDriverTypeComboBox, ComboBox.TextProperty, mAgent, nameof(Agent.DriverType));
                    xDriverTypeComboBox.SelectionChanged += driverTypeComboBox_SelectionChanged;
                }
                else//Plugin
                {
                    xDriverConfigPnl.Visibility = Visibility.Collapsed;
                    xPluginConfigPnl.Visibility = Visibility.Visible;

                    // Plugin combo
                    xPluginIdComboBox.ItemsSource       = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <PluginPackage>();
                    xPluginIdComboBox.DisplayMemberPath = nameof(PluginPackage.PluginId);
                    xPluginIdComboBox.BindControl(mAgent, nameof(Agent.PluginId));
                }
                if (mAgent.AgentType == eAgentType.Driver)
                {
                    xAgentConfigFrame.SetContent(new AgentDriverConfigPage(mAgent));
                }
                else
                {
                    // xAgentConfigFrame.SetContent(new NewAgentDriverConfigPage(mAgent));
                    xAgentConfigFrame.SetContent(new AgentDriverConfigPage(mAgent));
                }
            }
        }