示例#1
0
 Assembly activitySelector_AssemblyResolve(object sender, ResolveEventArgs args)
 {
     if (!String.IsNullOrEmpty(assemblyBox.Text))
     {
         return(RuleSetToolkitEditor.ResolveAssembly(assemblyBox.Text, args.Name));
     }
     return(null);
 }
示例#2
0
        private void activitiesBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            membersBox.Items.Clear();

            if (activitiesBox.SelectedItem != null)
            {
                membersBox.Items.AddRange(RuleSetToolkitEditor.GetMembers(activitiesBox.SelectedItem as Type).ToArray());
            }
        }
示例#3
0
        private void PopulateActivities()
        {
            activitiesBox.Items.Clear();

            var assembly = RuleSetToolkitEditor.LoadAssembly(assemblyBox.Text);

            if (assembly != null)
            {
                try
                {
                    var types = new List <Type>(assembly.GetTypes());
                    types.Sort(CompareTypes);

                    foreach (var type in types)
                    {
                        // add a check here if you want to constrain the kinds of Types (e.g. Activity) that rulesets can be authored against

                        //if (type.IsSubclassOf(typeof(Activity)))
                        //{
                        activitiesBox.Items.Add(type);
                        //}
                    }
                }
                catch (ReflectionTypeLoadException ex)
                {
                    MessageBox.Show(string.Format(CultureInfo.InvariantCulture, "Error loading types from assembly '{0}': \r\n\n{1}", assembly.FullName, ex.LoaderExceptions[0].Message), "Type Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            if (activity != null && activitiesBox.Items.Contains(activity))
            {
                activitiesBox.SelectedItem = activity;
            }

            else if (activitiesBox.Items.Count > 0)
            {
                activitiesBox.SetSelected(0, true);
            }
        }