Example #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn private void Selection_TargetSubject_NewItemCreated(object sender, EventArgs e)
        ///
        /// \brief Event handler. Called by Selection_TargetSubject for new item created events.
        ///
        /// \par Description.
        ///      If there is a new target subject empty the target algorithm
        ///
        /// \par Algorithm.
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 13/12/2017
        ///
        /// \param sender  (object) - Source of the event.
        /// \param e       (EventArgs) - Event information.
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        private void Selection_TargetSubject_NewItemCreated(object sender, EventArgs e)
        {
            string        text    = Selection_TargetSubject.TextBox_Selected.Text;
            List <string> options = new List <string> {
                text
            };

            data[3].options           = options;
            data[3].enableItems       = null;
            data[3].initiallySelected = new List <int> {
                0
            };
            Selection_TargetAlgorithm.Init(data[3]);
        }
Example #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn protected void Selection_TargetSubject_SelectionChanged(object sender, EventArgs e)
        ///
        /// \brief Event handler. Called by Selection_TargetSubject for selection changed events.
        ///
        /// \par Description.
        ///      The Target algorithms control change (To present the algorithms of the subject)
        ///
        /// \par Algorithm.
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 29/08/2017
        ///
        /// \param sender  (object) - Source of the event.
        /// \param e       (EventArgs) - Event information.
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        protected void Selection_TargetSubject_SelectionChanged(object sender, EventArgs e)
        {
            string subject = Selection_TargetSubject.TextBox_Selected.Text;

            if (subject != "")
            {
                List <string> options = TypesUtility.GetAlgorithmsOfSubject(subject);
                data[3].options = options.Concat(Config.Instance.GetAlgorithmsOfSubject(subject)).Distinct().ToList();
            }
            else
            {
                data[3].options = new List <string>();
            }
            data[3].enableItems = null;
            Selection_TargetAlgorithm.Init(data[3]);
        }
Example #3
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn public SourceTargetAlgorithmsSelect()
        ///
        /// \brief Default constructor.
        ///
        /// \par Description.
        ///
        /// \par Algorithm.
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 29/08/2017
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public SourceTargetAlgorithmsSelect()
        {
            InitializeComponent();
            List <SelectControlData> data = new List <SelectControlData>();

            // Create a list of the subjects and an enable list for them
            List <string> subjects             = TypesUtility.GetAlgorithmsSubjects();
            var           enableSubjectsSource = Enumerable.Repeat(true, subjects.Count).ToList();


            // Create the data for the source subject control
            // For the source subject the System subject is disabled (It cannot be used as source)
            enableSubjectsSource[subjects.IndexOf("Base")] = false;
            List <int> initialySelectedSubject = new List <int> {
                subjects.IndexOf("Templates")
            };

            data.Add(new SelectControlData()
            {
                options = subjects, enableItems = enableSubjectsSource, initiallySelected = initialySelectedSubject
            });

            // Create the data for the control of the source algorithm
            data.Add(new SelectControlData {
                options = new List <string>()
            });

            // Create the data for the control of the target subject
            // For the target subject the System and Templates subjects are diasabled
            List <string> allSubjects = subjects.Concat(Config.Instance.GetSubjects().ToList()).ToList();

            allSubjects = allSubjects.Distinct().ToList();
            var enableSubjectsTragets = Enumerable.Repeat(true, allSubjects.Count).ToList();

            enableSubjectsTragets[allSubjects.IndexOf("Base")]      = false;
            enableSubjectsTragets[allSubjects.IndexOf("Templates")] = false;
            data.Add(new SelectControlData {
                options = allSubjects, enableItems = enableSubjectsTragets
            });

            // Create the data for the control of the target algorithm
            data.Add(new SelectControlData {
                options = new List <string>()
            });
            this.data = data;

            // Order of changing the presentation according to selection change is as follows
            // Source subject change :
            //      The Source algorithms control change (To present the algorithms of the subject)
            //      The Target subject control change (To set the Target subject is set to the source subject
            // Target subject change :
            //      The Target algorithms control change (To present the algorithms of the subject)
            //
            // There for the order of initialize of the controls is in reverse order
            // (So the initiation will not override the data that was set by a control that is before
            // in the change chain)
            Selection_TargetAlgorithm.Init(data[3]);
            Selection_TargetSubject.Init(data[2]);
            Selection_SourceAlgorithm.Init(data[1]);
            Selection_SourceSubject.Init(data[0]);
        }