/// <summary>
        /// Adds all the connections to the dropdown
        /// </summary>
        void LoadConnections()
        {
            Connections.Items.Clear();

            // if no connection was passed in create a default item
            if (!_connectionId.HasValue)
            {
                ComboboxItem item = new ComboboxItem(0, "Select a Connection");
                Connections.Items.Add(item);
                Connections.SelectedItem = item;
            }

            // add each existing connection to the dropdown
            foreach (Connection cn in ClientData.Connections)
            {
                ComboboxItem item = new ComboboxItem(cn.Id, cn.ConnectionName);
                Connections.Items.Add(item);
                if (_connectionId.HasValue && _connectionId.Value == cn.Id)
                    Connections.SelectedItem = item;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Loads all solutions from the database and selects the last selection as recorded in settings
        /// </summary>
        void LoadSolutions()
        {
            Solutions.Items.Clear();
            Solutions.Text = "";

            // load a default if none have been selected
            if (!_solutionId.HasValue)
            {
                ComboboxItem item = new ComboboxItem(0, "Select a Solution");
                Solutions.Items.Add(item);
                Solutions.SelectedItem = item;
            }

            // load all the solutions
            foreach (Solution solution in ClientData.Solutions)
            {
                ComboboxItem item = new ComboboxItem(solution.Id, solution.SolutionName);
                Solutions.Items.Add(item);

                if (_solutionId.HasValue && _solutionId.Value == solution.Id)
                    Solutions.SelectedItem = item;
            }
        }