Esempio n. 1
0
        /// <summary>
        /// Gets the config panel for AddIns
        /// </summary>
        /// <returns>
        /// The config panel.
        /// </returns>
        public Panel GetConfigPanel()
        {
            // if panel made then leave it alone\

            //February 27 2013 -- I removed this because it would not notice addins added
            // at runtime, which was one of the main points for this (i.e., once panel was open it never refreshed)
            //	if (PanelWasMade == true)
            //		return configPanel;

            PanelWasMade = true;

            configPanel = new Panel ();
            configPanel.BackColor = Color.Blue;
            checkers = new CheckedListBox ();
            checkers.Parent = configPanel;
            checkers.Dock = DockStyle.Fill;
            checkers.BringToFront ();

            BuildListOfAddins ();

            if (null == AddInsList) {
                lg.Instance.Line ("Addins.GetConfigPanel", ProblemType.MESSAGE, "No AddIns discovered.");
            }
            //checkers.DataSource = AddInsList;
            //checkers.DisplayMember = "CalledFrom.MyMenuName";

            //#STEP #1 : Load the previous preferences (go back into GetConfigPanel)

            List<string> myList = GetListOfInstalledPlugs ();
            /*List<string>Guids = new List<string>();

            if (myList != null && myList.Count > 0) {

                foreach (object[] o in myList) {
                    string GUIDOfAPlugIn = o [0].ToString ();
                    Guids.Add (GUIDOfAPlugIn);
                }
            }*/

            foreach (MefAddIns.Extensibility.mef_IBase plug in AddInsList) {

                ListViewItem item = new ListViewItem (plug.CalledFrom.MyMenuName);
                item.Text = String.Format ("{0} ({1}) ", plug.Name, plug.Version.ToString ());
                if (plug.IsCopy) {
                    // a copy of this GUID was present
                    item.Text = item.Text + Loc.Instance.GetString (" (COPY) ");

                }

                item.Tag = plug.CalledFrom;
                bool IsChecked = false;
                bool IsDisabled = false;
                if (plug.dependencyguid != Constants.BLANK) {
                    IsDisabled = true;
                }
                bool IsVersionDisabled = false;
                if (plug.dependencymainapplicationversion != Constants.BLANK)
                {
                //	NewMessage.Show(String.Format ("Comparing {0} with Application {1}",plug.dependencymainapplicationversion, Application.ProductVersion));
                    Version plugNeedsVersion = new Version(plug.dependencymainapplicationversion);
                    Version appVersion = new Version(Application.ProductVersion);
                    if (plugNeedsVersion > appVersion)
                    {
                        IsVersionDisabled = true;
                    }
                }

                foreach (string guid in myList) {
                    if (guid == plug.CalledFrom.GUID) {
                        IsChecked = true;
                    }
                    if (IsDisabled == true)
                    {
                        // check to see if the GUID is enabled for my dependency
                        if (guid == plug.dependencyguid)
                        {
                            IsDisabled = false;
                        }
                    }

                }

                // we do not add Disabled Items
                if (true != IsDisabled ) {
                    if (true != IsVersionDisabled)
                    {
                        if (plug.CalledFrom.IsANote)
                        {
                            item.Text = String.Format ("{0} ({1})",item.Text,Loc.Instance.GetString("Deactivating requires application exit."));
                        }
                        checkers.Items.Add (item, IsChecked);
                    }
                    else
                    {
                        NewMessage.Show (Loc.Instance.GetStringFmt ("The Addin '{0}' was not added because it requires version '{1}' of the main application.", plug.Name, plug.dependencymainapplicationversion));
                    }
                }
                else
                {
                    NewMessage.Show (Loc.Instance.GetStringFmt("The AddIn '{0}' was not added because it requires the AddIn '{1}' to be installed", plug.Name, plug.dependencyguid));
                }

            }

            checkers.DisplayMember = "Text";
            return configPanel;
        }
Esempio n. 2
0
        public TutorialAssign()
        {
            this.Width     = 700;
            this.Height    = 500;
            this.BackColor = Color.White;

            Panel frontPanel = new Panel();

            frontPanel.Width     = this.Width - 10;
            frontPanel.Height    = this.Height - 10;
            frontPanel.BackColor = Color.White;
            frontPanel.Location  = new Point(this.Location.X + 5, this.Location.Y + 5);
            Controls.Add(frontPanel);
            frontPanel.SendToBack();
            frontPanel.Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, frontPanel.Width, frontPanel.Height, 18, 18));

            Panel backPanel = new Panel();

            backPanel.Width     = this.Width;
            backPanel.Height    = this.Height;
            backPanel.BackColor = ColorTranslator.FromHtml(Constants.AppSecondaryColour);
            backPanel.Location  = new Point(this.Location.X, this.Location.Y);
            Controls.Add(backPanel);
            backPanel.SendToBack();

            title = new Label()
            {
                Text      = "ASIGNÁ EL TOUR A UN ADULTO",
                Font      = Constants.HLabelFont,
                Width     = 500,
                Height    = 40,
                TextAlign = ContentAlignment.MiddleCenter,
            };
            title.Location = new Point(this.Width / 2 - title.Width / 2, 50);
            this.Controls.Add(title);
            title.BringToFront();

            subTitle           = new TextBox();
            subTitle.Multiline = true;
            subTitle.Width     = 450;
            subTitle.Height    = 100;
            this.Controls.Add(subTitle);
            subTitle.BorderStyle = BorderStyle.None;
            subTitle.Font        = Constants.H2LabelFont;
            subTitle.BringToFront();
            subTitle.Text      = "Seleccioná los adultos a los que quieras asignar el tour y después hacé click en la tilde para completar:";
            subTitle.TextAlign = HorizontalAlignment.Center;
            subTitle.Location  = new Point(this.Width / 2 - subTitle.Width / 2, 120);
            subTitle.TabStop   = false;
            subTitle.BringToFront();

            BackButton = new AsistimeRoundButton(98, 98, Constants.CancelRedImageW, Constants.CancelRedHoverImageW, Constants.CancelRedClickImageW)
            {
                Parent = this.Parent
            };
            BackButton.Location = new Point(30, 372);
            BackButton.Click   += new EventHandler(this.Back);
            this.Controls.Add(BackButton);
            BackButton.BringToFront();

            ForwardButton = new AsistimeRoundButton(98, 98, Constants.ConfirmGreenImageW, Constants.ConfirmGreenHoverImageW, Constants.ConfirmGreenClickImageW)
            {
                Parent = this.Parent
            };
            ForwardButton.Location = new Point(572, 372);
            ForwardButton.Click   += new EventHandler(this.Forward);
            this.Controls.Add(ForwardButton);
            ForwardButton.BringToFront();

            userController = new UserController();
            adultsChecked  = new List <int>();

            //Busco lista de usuarios
            adults = userController.GetAdults().Result;
            var ad = adults.Select(a => a.name).ToArray();

            checkedListBox1 = new CheckedListBox();
            checkedListBox1.Items.AddRange(ad);
            checkedListBox1.SelectedIndexChanged += new EventHandler(OnSelect);
            this.Controls.Add(checkedListBox1);
            checkedListBox1.BringToFront();
            checkedListBox1.CheckOnClick = true;
            checkedListBox1.Font         = Constants.H2LabelFont;
            checkedListBox1.BorderStyle  = BorderStyle.None;
            checkedListBox1.Width        = this.Width / 2;
            checkedListBox1.Height       = this.Height / 2;
            checkedListBox1.Location     = new Point((this.Width / 2) - (checkedListBox1.Width / 2), 220);

            Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
        }