/// <summary>
        ///     Handles initialization events
        /// </summary>
        /// <param name="alfred"></param>
        protected override void InitializeProtected(IAlfred alfred)
        {
            _widgets.Clear();

            // Read the subsystems from Alfred
            if (AlfredInstance != null)
            {
                foreach (var item in AlfredInstance.Subsystems)
                {
                    var widget = BuildSubsystemWidget(item);

                    _widgets.Add(widget);

                    Register(widget);
                }
            }

            // We'll want to display a fallback for no subsystems
            if (_widgets.Count == 0)
            {
                var noSubsystemsDetected =
                    Resources.AlfredSubSystemListModule_NoSubsystemsDetected.NonNull();

                Log("Subsystems.Initialize", noSubsystemsDetected, LogLevel.Warning);

                var widget = new TextWidget(noSubsystemsDetected,
                                            BuildWidgetParameters(@"lblNoSubsystems"));
                _widgets.Add(widget);

                Register(widget);
            }
        }
Beispiel #2
0
        /// <summary>
        ///     Handles initialization events
        /// </summary>
        /// <param name="alfred"></param>
        protected override void InitializeProtected(IAlfred alfred)
        {
            LastInitialized = DateTime.Now;

            base.InitializeProtected(alfred);
        }
Beispiel #3
0
 /// <summary>
 ///     Handles initialization events
 /// </summary>
 /// <param name="alfred">The alfred instance.</param>
 protected override void InitializeProtected(IAlfred alfred)
 {
     // Tell the chat engine where to send its mail
     _commandRouter.Alfred = alfred;
     ChatHandler.UpdateOwner(_commandRouter);
 }
        /// <summary>
        /// Handles initialization events
        /// </summary>
        /// <param name="alfred">The Alfred instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="alfred"/> is <see langword="null" />.</exception>
        protected override void InitializeProtected(IAlfred alfred)
        {
            if (alfred == null) { throw new ArgumentNullException(nameof(alfred)); }

            // Add alfred to the collection as the root level will only contain Alfred.
            MindExplorerPage.ClearNodes();
            MindExplorerPage.AddRootNode(alfred);
        }
Beispiel #5
0
 /// <summary>
 ///     Handles module initialization events
 /// </summary>
 /// <param name="alfred"></param>
 protected override void InitializeProtected(IAlfred alfred)
 {
     Register(WidgetsToRegisterOnInitialize);
 }
Beispiel #6
0
 /// <summary>
 ///     Handles module initialization events
 /// </summary>
 /// <param name="alfred"></param>
 protected override void InitializeProtected(IAlfred alfred)
 {
     Register(_diskReadWidget);
     Register(_diskWriteWidget);
 }
Beispiel #7
0
        /// <summary>
        ///     Handles module initialization events
        /// </summary>
        /// <param name="alfred"></param>
        protected override void InitializeProtected(IAlfred alfred)
        {
            Register(CurrentDateWidget);
            Register(CurrentTimeWidget);
            Register(AlertWidget);

            // Ensure it has some initial values so it doesn't "blink" or lag on start
            ClearLastTimeRun();
            Update(DateTime.Now);
        }
Beispiel #8
0
 /// <summary>
 ///     Handles module initialization events
 /// </summary>
 /// <param name="alfred"></param>
 protected override void InitializeProtected(IAlfred alfred)
 {
     AddOnlineWidgets();
 }
Beispiel #9
0
        /// <summary>
        ///     Called when the component is registered.
        /// </summary>
        /// <param name="alfred">The Alfred instance.</param>
        public override void OnRegistered(IAlfred alfred)
        {
            base.OnRegistered(alfred);

            UpdateAlfredProviderStatus();

            if (AlfredInstance != null)
            {
                // Add the appropriate UI elements
                if (AlfredInstance.Status == AlfredStatus.Online)
                {
                    AddOnlineWidgets();
                }
                else
                {
                    AddOfflineWidgets();
                }
            }
        }
Beispiel #10
0
        /// <summary>
        ///     Handles module initialization events
        /// </summary>
        /// <param name="alfred"></param>
        protected override void InitializeProtected(IAlfred alfred)
        {
            BuildCounters();

            _cpuWidgets.Clear();

            var core = 1;

            foreach (var counter in _processorCounters.OrderBy(c => c.Name))
            {
                // Don't add a core indicator for the total
                Debug.Assert(counter != null);
                if (counter.Name == TotalInstanceName) { continue; }

                // Create a widget for the counter
                // Store the counter as the widget's data context for easier updating later on
                var id = string.Format(Locale, @"progProcessor{0}", counter.Name);
                var widget = new AlfredProgressBarWidget(BuildWidgetParameters(id))
                {
                    DataContext = counter,
                    Minimum = 0,
                    Maximum = 100
                };

                // Get the first value of the widget and have the label applied to the widget
                var label = string.Format(CultureInfo.CurrentCulture, _cpuMonitorLabel, core);
                UpdateCpuWidget(widget, counter, label);

                _cpuWidgets.Add(widget);

                Register(widget);

                core++;
            }
        }
 /// <summary>
 ///     Handles module initialization events
 /// </summary>
 /// <param name="alfred">The Alfred instance.</param>
 protected override void InitializeProtected(IAlfred alfred)
 {
     Register(_widget);
 }