Esempio n. 1
0
        public void UpdateNameLabel(string channel, string field)
        {
            Name = channel + field;

            UpdateToolStripMenuItemText?.Invoke(channel + " " + field);

            if (labelName.IsHandleCreated)
            {
                if (_settings.ChannelNameVisable && _settings.FieldNameVisable)
                {
                    labelName.Invoke(new Action(() => labelName.Text = channel + " " + field));
                }
                else if (_settings.ChannelNameVisable)
                {
                    labelName.Invoke(new Action(() => labelName.Text = channel));
                }
                else if (_settings.FieldNameVisable)
                {
                    labelName.Invoke(new Action(() => labelName.Text = field));
                }
                else
                {
                    labelName.Invoke(new Action(() => labelName.Text = ""));
                }

                Invoke(new Action(() => ResizeWidget()));
            }
        }
Esempio n. 2
0
        public WidgetForm(Settings settings) : this()
        {
            widgetUC                              = new WidgetUC(settings);
            widgetUC.Location                     = new Point(0, 0);
            widgetUC.ResizeWidgetEvent           += ResizeWidget;
            widgetUC.UpdateToolStripMenuItemText += s => UpdateToolStripMenuItemText?.Invoke(s);
            widgetUC.Widget_MouseUp              += WidgetForm_MouseUp;
            widgetUC.Widget_MouseMove            += Form1_MouseMove;
            widgetUC.Widget_MouseDown            += Form1_MouseDown;

            Controls.Add(widgetUC);

            chartUc                  = new ChartUc();
            chartUc.Location         = new Point(widgetUC.Location.X, widgetUC.Location.Y + widgetUC.Height);
            chartUc.Chart_MouseDown += WidgetForm_MouseUp;
            chartUc.Chart_MouseMove += Form1_MouseMove;
            chartUc.Chart_MouseDown += Form1_MouseDown;
            chartUc.LoadSetting(settings);
            chartUc.Visible = false;

            if (settings.ChartSettings != null)
            {
                if (settings.ChartSettings.Visable)
                {
                    chartUc.Visible = true;
                }
                else
                {
                    chartUc.Visible = false;
                }
            }
            _manager.SetData += chartUc.UpdateData;

            Controls.Add(chartUc);

            _manager.SetTemperatureLabel += widgetUC.UpdateTemperatureLabel;
            //_manager.SetUpdateDataLabel += widgetUC.UpdataDateTimeLabel;
            _manager.SetUpdateDataLabel += widgetUC.UpdataDateTimeLabel;
            _manager.SetNameLabel       += widgetUC.UpdateNameLabel;


            widgetUC.Visible = true;
            widgetUC.Show();

            LoadSettings(settings);
        }