コード例 #1
0
 public ContatoController(ConfigApiClient api,
                          EmailContatoApiClient apiEmail, IEmailService emailService)
 {
     _api          = api;
     _emailService = emailService;
     _apiEmail     = apiEmail;
 }
コード例 #2
0
        public TaskUserControl(ConfigurationItem item, ConfigurationItem[] childrens, ConfigApiClient configApiClient)
        {
            InitializeComponent();

            _configApiClient = configApiClient;

            if (childrens != null && childrens.Any())
            {
                tableLayoutPanel1.ColumnCount = 5;
                tableLayoutPanel1.RowCount    = childrens.Length + 1;

                tableLayoutPanel1.ColumnStyles[0] = new ColumnStyle(SizeType.AutoSize);
                tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
                tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
                tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
                tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));

                for (int ix = 0; ix < childrens.Length; ix++)
                {
                    ConfigurationItem child = childrens[ix];

                    int iy = 0;

                    if (ix < tableLayoutPanel1.RowStyles.Count)
                    {
                        tableLayoutPanel1.RowStyles[ix] = new RowStyle(SizeType.AutoSize);
                    }
                    else
                    {
                        tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.AutoSize));
                    }

                    tableLayoutPanel1.Controls.Add(MakeControl(child.Path), iy + 0, ix);

                    foreach (Property pi in child.Properties) // We assume here that the children have same settings!
                    {
                        if (pi.Key == "State")
                        {
                            tableLayoutPanel1.Controls.Add(MakeControl(pi), iy + 1, ix);
                        }
                        if (pi.Key == "Progress")
                        {
                            tableLayoutPanel1.Controls.Add(MakeControl(pi), iy + 2, ix);
                        }
                    }

                    if (child.MethodIds.Contains("TaskStop"))
                    {
                        tableLayoutPanel1.Controls.Add(MakeButton("Stop", child), iy + 3, ix);
                    }
                    if (child.MethodIds.Contains("TaskCleanup"))
                    {
                        tableLayoutPanel1.Controls.Add(MakeButton("Cleanup", child), iy + 4, ix);
                    }

                    tableLayoutPanel1.Height = 25 * (childrens.Length + 1) + 1;
                }
            }
        }
コード例 #3
0
        public TabUserControl(ConfigurationItem item, ConfigApiClient configApiClient)
        {
            InitializeComponent();

            _configApiClient = configApiClient;
            _item            = item;

            OnLoad();
        }
コード例 #4
0
        public PrivacyMaskUserControl(ConfigurationItem item, ConfigApiClient configApiClient)
        {
            InitializeComponent();

            _item             = item;
            _bitmapLiveImages = new BitmapLiveImages(_item, configApiClient);
            _bitmapLiveImages.ImageReceivedEvent += _bitmapLiveImages_ImageReceivedEvent;
            _bitmapLiveImages.Init();
        }
コード例 #5
0
        public void Init(Property property, ConfigApiClient configApiClient)
        {
            _property        = property;
            _configApiClient = configApiClient;

            this.Text = property.DisplayName;

            if (property.IsSettable)
            {
                if (property.ValueTypeInfos == null)
                {
                    throw new Exception("ValueTypeInfo is null on Path");
                }

                string text = "";
                foreach (ValueTypeInfo valueTypeInfo in property.ValueTypeInfos)
                {
                    if (valueTypeInfo.Name == ValueTypeInfoNames.PathItemType)
                    {
                        var valueTypes = valueTypeInfo.Value.Split(',');
                        foreach (var valueType in valueTypes)
                        {
                            var itemType = valueType;
                            if (itemType.EndsWith("Folder"))
                            {
                                itemType = itemType.Substring(0, itemType.Length - 6);
                            }
                            itemTypes.Add(itemType);
                            if (!String.IsNullOrEmpty(text))
                            {
                                text += ", ";
                            }
                            text += itemType;
                        }
                    }
                    if (valueTypeInfo.Name == ValueTypeInfoNames.PathAllowAllItemType)
                    {
                        _allowAll = true;
                    }
                }
                buttonAdd.Enabled    = true;
                buttonRemove.Enabled = false;
            }
            else
            {
                buttonAdd.Enabled    = false;
                buttonRemove.Enabled = false;
            }
            if (!string.IsNullOrEmpty(property.Value))
            {
                string[] paths = property.Value.Split(';');
                foreach (string path in paths)
                {
                    listBox1.Items.Add(path);
                }
            }
        }
コード例 #6
0
        public SimpleUserControl(ConfigurationItem item, bool showChildren, ConfigApiClient configApiClient, ConfigurationItem privacyMaskItem)
        {
            InitializeComponent();

            _configApiClient = configApiClient;
            _showChildren    = showChildren;
            _item            = item;
            _privacyMaskItem = privacyMaskItem;
            InitalizeUI();
        }
コード例 #7
0
        public PathListPropertyUserControl(Property property, ConfigApiClient configApiClient)
            : base(property)
        {
            InitializeComponent();

            _configApiClient = configApiClient;

            HasChanged = false;
            _origY     = button1.Left;

            labelOfProperty.Text = property.DisplayName;
            string[] parts = !string.IsNullOrEmpty(property.Value)? property.Value.Split(';'): new string[0];
            button1.Text = string.Format("{0} selected. Modify ...", parts.Length);
        }
コード例 #8
0
        public BitmapLiveImages(ConfigurationItem item, ConfigApiClient configApiClient)
        {
            _item            = item;
            _configApiClient = configApiClient;
            lock (_imageLock)
            {
                _lastBitmap = new Bitmap(320, 240);

                Graphics g = Graphics.FromImage(_lastBitmap);
                g.FillRectangle(Brushes.Black, 0, 0, _lastBitmap.Width, _lastBitmap.Height);
                g.DrawString("no images", new Font(FontFamily.GenericMonospace, 12), Brushes.White, new PointF(20, 100));
                g.Dispose();
            }
        }
コード例 #9
0
        public PathPropertyUserControl(Property property, ConfigApiClient configApiClient)
            : base(property)
        {
            InitializeComponent();

            _configApiClient = configApiClient;

            labelOfProperty.Text = property.DisplayName;

            if (property.IsSettable)
            {
                if (property.ValueTypeInfos == null)
                {
                    throw new Exception("ValueTypeInfo is null on Path");
                }

                foreach (ValueTypeInfo valueTypeInfo in property.ValueTypeInfos)
                {
                    if (valueTypeInfo.Name == ValueTypeInfoNames.PathItemType)
                    {
                        itemtype = valueTypeInfo.Value;
                        break;
                    }
                }
                if (itemtype.EndsWith("Folder"))
                {
                    itemtype = itemtype.Substring(0, itemtype.Length - 6);
                }
                if (!String.IsNullOrEmpty(property.Value))
                {
                    button1.Text = property.Value;
                }
                else
                {
                    button1.Text = "Select a " + itemtype;
                }
            }
            else
            {
                button1.Text    = property.Value;
                button1.Enabled = false;
            }
            HasChanged = false;
            _origY     = button1.Left;

            this.GotFocus += EnumPropertyUserControl_GotFocus;
        }
コード例 #10
0
 public HomeController(IOptions <SettingsModel> app,
                       IConfiguration configuration,
                       NoticiasApiClient api,
                       SobreApiClient apiSobre,
                       ConfigApiClient apiConfiguracao,
                       CarrosselApiClient apiCarrossel,
                       PoloApiClient apiPolo)
 {
     appSettings      = app;
     _configuration   = configuration;
     _api             = api;
     _apiSobre        = apiSobre;
     _apiCarrossel    = apiCarrossel;
     _apiPolo         = apiPolo;
     _apiConfiguracao = apiConfiguracao;
     ApplicationSettings.WebApiUrl = appSettings.Value.WebApiBaseUrl;
 }
コード例 #11
0
        public PropertyEnableUserControl(ConfigurationItem item, EventHandler valueChangedHandler, int leftOffset, ConfigApiClient configApiClient, string toHaveFocus = null)
        {
            InitializeComponent();

            _item = item;
            _valueChangedHandler = valueChangedHandler;
            _configApiClient     = configApiClient;

            if (item.EnableProperty != null)
            {
                EnabledCheckBox.Checked = item.EnableProperty.Enabled;
                EnabledCheckBox.Text    = item.EnableProperty.DisplayName;
            }
            else
            {
                EnabledCheckBox.Visible = false;
            }

            this.Height = PanelUtils.BuildPropertiesUI(item, 0, leftOffset, panelContent, valueChangedHandler, _configApiClient, toHaveFocus);
        }
コード例 #12
0
        public PropertyListUserControl(ConfigurationItem item, EventHandler valueChangedHandler, int leftOffset, ConfigApiClient configApiClient, string toHaveFocus)
        {
            InitializeComponent();

            _configApiClient     = configApiClient;
            _valueChangedHandler = valueChangedHandler;

            if (item.EnableProperty != null)
            {
                EnabledCheckBox.Visible = true;
                EnabledCheckBox.Checked = item.EnableProperty.Enabled;
                EnabledCheckBox.Text    = item.EnableProperty.DisplayName;
            }
            else
            {
                EnabledCheckBox.Visible = false;
                textBoxName.Location    = EnabledCheckBox.Location;
            }

            textBoxName.Text = item.DisplayName;

            int totalContentHeight = this.Height;            // panelContent.Location.Y;

            totalContentHeight += PanelUtils.BuildPropertiesUI(item, 0, leftOffset, panelContent, valueChangedHandler, _configApiClient, toHaveFocus);

            if (!item.ChildrenFilled)                   //TODO exception stuff, or load elsewhere
            {
                try
                {
                    item.Children       = _configApiClient.GetChildItems(item.Path);
                    item.ChildrenFilled = true;
                } catch (Exception ex)
                {
                    MessageBox.Show(String.Format("GetChildItems({0}) : {1}", item.Path, ex.Message));
                }
            }

            if (item.Children != null)
            {
                leftOffset += Constants.LeftIndentChildControl;
                foreach (ConfigurationItem child in item.Children)
                {
                    if ((child.Children == null || child.Children.Length == 0) && child.EnableProperty != null)
                    {
                        UserControl uc = new PropertyEnableUserControl(child, valueChangedHandler, leftOffset, _configApiClient, toHaveFocus);
                        uc.Width            = panelContent.Width;
                        uc.Location         = new Point(Constants.LeftIndentChildControl, panelContent.Height);
                        uc.Anchor           = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        this.Height        += uc.Height;
                        totalContentHeight += uc.Height;
                        panelContent.Controls.Add(uc);
                    }
                    else
                    {
                        UserControl uc = new PropertyListUserControl(child, valueChangedHandler, leftOffset, _configApiClient, toHaveFocus);
                        uc.Width            = panelContent.Width;
                        uc.Location         = new Point(Constants.LeftIndentChildControl, panelContent.Height);
                        uc.Anchor           = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                        this.Height        += uc.Height;
                        totalContentHeight += uc.Height;
                        panelContent.Controls.Add(uc);
                    }
                }
                //panelContent.Height = totalContentHeight;
            }
            this.Height = totalContentHeight;
        }
コード例 #13
0
 public ConfigController(ConfigApiClient api, IConfiguration configuration)
 {
     _api           = api;
     _configuration = configuration;
 }
コード例 #14
0
 public Telefones(ConfigApiClient apiConfiguracao)
 {
     _apiConfiguracao = apiConfiguracao;
 }
コード例 #15
0
        internal static int BuildPropertiesUI(ConfigurationItem item, int top, int offset, Control parent, EventHandler valueChangedHandler, ConfigApiClient configApiClient, string toHaveFocus = null)
        {
            if (item.Properties != null)
            {
                foreach (Property property in item.Properties)
                {
                    if (property.UIImportance == 2 || MainForm.ShowHiddenProperties || property.UIImportance == 0 && MainForm.Advanced)
                    {
                        PropertyUserControl uc;
                        switch (property.ValueType)
                        {
                        case ValueTypes.IntType:
                            uc = new IntPropertyUserControl(property);
                            break;

                        case ValueTypes.DoubleType:
                            uc = new DoublePropertyUserControl(property);
                            break;

                        case ValueTypes.TickType:
                            uc = new TickPropertyUserControl(property);
                            break;

                        case ValueTypes.EnumType:
                            uc = new EnumPropertyUserControl(property);
                            break;

                        case ValueTypes.SliderType:
                            uc = new SliderPropertyUserControl(property);
                            break;

                        case ValueTypes.Path:
                            uc = new PathPropertyUserControl(property, configApiClient);
                            break;

                        case ValueTypes.PathList:
                            uc = new PathListPropertyUserControl(property, configApiClient);
                            break;

                        case ValueTypes.DateTimeType:
                        case "Date":
                        case "Time":
                            if (property.IsSettable)
                            {
                                uc = new DateTimePickerPropertyUserControl(property);
                            }
                            else
                            {
                                uc = new DateTimeDisplayPropertyUserControl(property);
                            }
                            break;

                        case ValueTypes.SeparatorType:
                            uc = new SeperatorPropertyUserControl(property);
                            break;

                        case ValueTypes.ProgressType:
                        case ValueTypes.StringType:
                        default:
                            uc = new StringPropertyUserControl(property);
                            break;
                        }
                        uc.Location      = new Point(0, top);
                        uc.Tag           = property;
                        uc.Anchor        = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
                        uc.ValueChanged += new EventHandler(valueChangedHandler);
                        uc.LeftIndent    = offset;
                        if (property.ToolTipTranslationId != null)
                        {
                            uc.ToolTip = configApiClient.Translate(property.ToolTipTranslationId);
                        }

                        ScrollPanel sp = parent as ScrollPanel;
                        if (sp != null)
                        {
                            sp.Add(uc);
                        }
                        else
                        {
                            parent.Controls.Add(uc);
                            if (uc.Top + uc.Height > parent.Height)
                            {
                                parent.Height = uc.Top + uc.Height;
                            }
                        }

                        top += uc.Height;

                        if (property.Key == toHaveFocus)
                        {
                            uc.WeGotFocus(null, null);
                        }
                    }
                }
            }
            return(top);
        }