Exemplo n.º 1
0
        private CancellationTokenSource m_cancellationTokenSource; // For cancelling thread awaiting rider start



        public MainForm(IServiceProvider serviceProvider, IConfiguration configuration, ZPMonitorService zpMonitorService, ILoggerFactory loggerFactory)
        {
            m_logger           = loggerFactory.CreateLogger <MainForm>();;
            m_serviceProvider  = serviceProvider;
            m_zpMonitorService = zpMonitorService;
            m_loggerFactory    = loggerFactory;

            m_maCollection  = new Dictionary <DurationType, MovingAverageWrapper>();
            m_summaryHelper = new SummaryHelper(new SummaryListViewItem(new SummaryItem()));
            //m_labelUnits = new Dictionary<string, string>();

            //m_labelHelpers = new List<LabelHelper>();

            m_normalizedPower = new NormalizedPower(zpMonitorService, loggerFactory);
            m_normalizedPower.NormalizedPowerChangedEvent += NormalizedPowerChangedEventHandler;
            m_normalizedPower.MetricsChangedEvent         += MetricsChangedEventHandler;

            InitializeComponent();

            // This rounds the edges of the borderless window
            this.Region = System.Drawing.Region.FromHrgn(ZAMsettings.CreateRoundRectRgn(0, 0, Width, Height, 15, 15));
            btnClose.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255); //transparent

            //MainForm.colorListViewHeader(ref lvViewer, lvViewer.BackColor, Color.White); // transparent ListView headers
            //MainForm.colorListViewHeader(ref lvOverall, lvOverall.BackColor, Color.White); // transparent ListView headers
            SetListViewHeaderColor(ref lvViewer, Color.FromArgb(255, 243, 108, 61), Color.White);  // Orange ListView headers
            SetListViewHeaderColor(ref lvOverall, Color.FromArgb(255, 243, 108, 61), Color.White); // Orange ListView headers
        }
Exemplo n.º 2
0
        protected override void UserControlBase_Load(object sender, EventArgs e)
        {
            if (DesignMode)
            {
                return;
            }

            // for handling UI events
            m_dispatcher = Dispatcher.CurrentDispatcher;

            this.Logger = ZAMsettings.LoggerFactory.CreateLogger <MainViewControl>();

            // NormalizedPower is instantiated here rather than constructor because it was preventing ability to drag/drop control on to a form.
            // This was because it creates a Logger in its constructor and the LoggerFactor isn't of course available.
            m_normalizedPower = new NormalizedPower();
            m_normalizedPower.NormalizedPowerChangedEvent += NormalizedPowerChangedEventHandler;
            m_normalizedPower.MetricsChangedEvent         += MetricsChangedEventHandler;

            this.lvOverall.Items.Clear();
            this.lvOverall.Items.Add(m_summaryHelper.SummaryListViewItem);

            base.UserControlBase_Load(sender, e);
        }