Example #1
0
        /// <summary>
        /// Overloaded constructor that accepts a reference to a collection of dashboad items. Presumably, this is the collection used by the Dashboard Panel.
        /// </summary>
        /// <param name="dashboardItems">Collection of dashboard items to edit.</param>
        public DashboardPanelProperties(DashboardPanel parent)
        {
            int counter = 0;

            _parent = parent;
            InitializeComponent();

            // Populate our list of choices
            foreach (Type nextHandlerType in ELM327Connection.LoadedHandlerTypes)
            {
                HandlerWrapper wrapper = new HandlerWrapper(nextHandlerType);

                if (wrapper.HandlerCategory == HandlerCategory.REAL_TIME_STATUS)
                {
                    _panelPropertyOptions.Add(new PanelPropertyOption(wrapper, _panelPropertyOptions.Count));
                }
            }

            // Move items to their positions and mark the selected ones
            foreach (String nextHandlerName in ((String)Properties.ApplicationSettings.Default[Variables.SETTINGS_DASHBOARD_HANDLERS]).Split(Variables.SETTINGS_SEPARATOR))
            {
                String actualHandlerName = String.Copy(nextHandlerName);
                bool   isShown           = false;

                if (actualHandlerName.Length > 0)
                {
                    if (actualHandlerName[0] == '+')
                    {
                        isShown           = true;
                        actualHandlerName = actualHandlerName.Substring(1);
                    }

                    for (int i = 0; i < _panelPropertyOptions.Count; i++)
                    {
                        PanelPropertyOption nextOption = _panelPropertyOptions[i];

                        if (nextOption.HandlerWrapper.HandlerType.Name.Equals(actualHandlerName))
                        {
                            _panelPropertyOptions[i].IsChecked = isShown;
                            _panelPropertyOptions[i].Position  = counter;
                            _panelPropertyOptions.Move(i, counter++);
                            break;
                        }
                    }
                }
            }

            // Set the columns
            _columns = _parent.Columns;

            OnPropertyChanged("PanelPropertyOptions");
            OnPropertyChanged("Columns");
        }
        /// <summary>
        /// Overloaded constructor that accepts a reference to a collection of dashboad items. Presumably, this is the collection used by the Dashboard Panel.
        /// </summary>
        /// <param name="dashboardItems">Collection of dashboard items to edit.</param>
        public DashboardPanelProperties(DashboardPanel parent)
        {
            int counter = 0;
            this._parent = parent;
            InitializeComponent();

            // Populate our list of choices
            foreach (Type nextHandlerType in ELM327Connection.LoadedHandlerTypes)
            {
                HandlerWrapper wrapper = new HandlerWrapper(nextHandlerType);

                if (wrapper.HandlerCategory == HandlerCategory.REAL_TIME_STATUS)
                {
                    _panelPropertyOptions.Add(new PanelPropertyOption(wrapper, _panelPropertyOptions.Count));
                }
            }

            // Move items to their positions and mark the selected ones
            foreach (String nextHandlerName in ((String)Properties.ApplicationSettings.Default[Variables.SETTINGS_DASHBOARD_HANDLERS]).Split(Variables.SETTINGS_SEPARATOR))
            {
                String actualHandlerName = String.Copy(nextHandlerName);
                bool isShown = false;

                if (actualHandlerName.Length > 0)
                {
                    if (actualHandlerName[0] == '+')
                    {
                        isShown = true;
                        actualHandlerName = actualHandlerName.Substring(1);
                    }

                    for(int i = 0; i < _panelPropertyOptions.Count; i++)
                    {
                        PanelPropertyOption nextOption = _panelPropertyOptions[i];

                        if (nextOption.HandlerWrapper.HandlerType.Name.Equals(actualHandlerName))
                        {
                            _panelPropertyOptions[i].IsChecked = isShown;
                            _panelPropertyOptions[i].Position = counter;
                            _panelPropertyOptions.Move(i, counter++);
                            break;
                        }
                    }
                }
            }

            // Set the columns
            this._columns = this._parent.Columns;

            this.OnPropertyChanged("PanelPropertyOptions");
            this.OnPropertyChanged("Columns");
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.DashboardPanelControl = ((ObdExpress.Ui.UserControls.HomePanels.DashboardPanel)(target));
     return;
     case 2:
     
     #line 25 "..\..\..\..\..\Ui\UserControls\HomePanels\DashboardPanel.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.menItemProperties_Click);
     
     #line default
     #line hidden
     return;
     case 3:
     
     #line 26 "..\..\..\..\..\Ui\UserControls\HomePanels\DashboardPanel.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.menItemRemove_Click);
     
     #line default
     #line hidden
     return;
     }
     this._contentLoaded = true;
 }