예제 #1
0
        private void cboCategories_SelectedIndexChanged(object sender, EventArgs e)
        {
            var      key = ((KeyValuePair <int, string>)cboCategories.SelectedItem).Key;
            Assembly assembly;

            switch (key)
            {
            case 1:
                assembly        = Assembly.GetAssembly(typeof(AccountRepository));
                _displayClasses = assembly.GetTypes().Where(t => t.Namespace != null && t.IsClass && t.IsPublic).ToList();
                if (_displayClasses.Any())
                {
                    var uw = new DAL.DbEntity.UnitOfWork();
                    _constorInfoUniversal = new ConstructorInfo
                    {
                        ConstorParamType = new[] { uw.GetContext().GetType() },
                        ConstorParams    = new[] { uw.GetContext() }
                    };
                }
                _bFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public;
                break;

            case 2:
                assembly = Assembly.GetAssembly(typeof(AccountRepositorySealed));
                //TekTak.iLoop.Sealed
                _displayClasses       = assembly.GetTypes().Where(t => t.Namespace != null && t.Namespace.StartsWith("TekTak.iLoop.Sealed", StringComparison.OrdinalIgnoreCase) && t.IsClass && t.IsPublic).ToList();
                _constorInfoUniversal = _constorInfo;
                _bFlags = BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.Public;
                break;

            case 3:
                assembly        = Assembly.GetAssembly(typeof(AccountService));
                _displayClasses = assembly.GetTypes().Where(t => t.Namespace != null && t.IsClass && t.IsPublic).ToList();
                if (_displayClasses.Any())
                {
                    var uw  = new DAL.DbEntity.UnitOfWork();
                    var uow = new TekTak.iLoop.UOW.UnitOfWork();
                    _constorInfoUniversal = new ConstructorInfo
                    {
                        ConstorParamType = new[] { uw.GetType(), uow.GetType() },
                        ConstorParams    = new object[] { uw, uow }
                    };
                }
                _bFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public;
                break;
            }
            _cboItems = new Dictionary <string, string>();
            foreach (var type in _displayClasses)
            {
                var display = type.Name.IndexOf("Repo", StringComparison.Ordinal) > 0
                    ? type.Name.Substring(0, type.Name.IndexOf("Repo", StringComparison.Ordinal))
                    : type.Name;
                display = display.EndsWith("Service", StringComparison.OrdinalIgnoreCase) ? display.Substring(0, display.LastIndexOf("Service", StringComparison.OrdinalIgnoreCase)) : display;
                _cboItems.Add(type.FullName, display.AddSpaceBeforeCapitalLetters());
            }
            cboClasses.DataSource    = new BindingSource(_cboItems, null);
            cboClasses.DisplayMember = "Value";
            cboClasses.ValueMember   = "Key";
            cboClasses.SelectedIndex = 0;
        }
예제 #2
0
        private void Test_Load(object sender, EventArgs e)
        {
            _attType = typeof(AsyncStateMachineAttribute);
            _assemblies = AppDomain.CurrentDomain.GetAssemblies();
            _ignoreList = new[] { "Equals", "GetHashCode", "GetType", "ToString" };

            _cboCategories = new Dictionary<int, string> { { 1, "EF" }, { 2, "RPC" }, { 3, "BAL" } };
            cboCategories.DataSource = new BindingSource(_cboCategories, null);
            cboCategories.DisplayMember = "Value";
            cboCategories.ValueMember = "Key";
            //cboCategories.SelectedIndex = 0;

            _state = new State();
            var uow = new TekTak.iLoop.UOW.UnitOfWork();
            _constorInfo = new ConstructorInfo
            {
                ConstorParamType = new[] { uow.GetServices().GetType() },
                ConstorParams = new object[] { uow.GetServices() }
            };
            LoadState();
            _samples = API.SampleConfig.GetSamples();
            cboClasses.SelectedIndex = cboClasses.Items.Count >= _state.Combo ? _state.Combo : 0;
            if (treeMethods.Nodes.Count > 0) treeMethods.SelectedNode = treeMethods.Nodes.Count > _state.Node ? treeMethods.Nodes[_state.Node] : treeMethods.Nodes[0];
            treeMethods.Focus();

        }
예제 #3
0
        private void Test_Load(object sender, EventArgs e)
        {
            _attType    = typeof(AsyncStateMachineAttribute);
            _assemblies = AppDomain.CurrentDomain.GetAssemblies();
            _ignoreList = new[] { "Equals", "GetHashCode", "GetType", "ToString" };

            _cboCategories = new Dictionary <int, string> {
                { 1, "EF" }, { 2, "RPC" }, { 3, "BAL" }
            };
            cboCategories.DataSource    = new BindingSource(_cboCategories, null);
            cboCategories.DisplayMember = "Value";
            cboCategories.ValueMember   = "Key";
            //cboCategories.SelectedIndex = 0;

            _state = new State();
            var uow = new TekTak.iLoop.UOW.UnitOfWork();

            _constorInfo = new ConstructorInfo
            {
                ConstorParamType = new[] { uow.GetServices().GetType() },
                ConstorParams    = new object[] { uow.GetServices() }
            };
            LoadState();
            _samples = API.SampleConfig.GetSamples();
            cboClasses.SelectedIndex = cboClasses.Items.Count >= _state.Combo ? _state.Combo : 0;
            if (treeMethods.Nodes.Count > 0)
            {
                treeMethods.SelectedNode = treeMethods.Nodes.Count > _state.Node ? treeMethods.Nodes[_state.Node] : treeMethods.Nodes[0];
            }
            treeMethods.Focus();
        }
예제 #4
0
 private void cboCategories_SelectedIndexChanged(object sender, EventArgs e)
 {
     var key = ((KeyValuePair<int, string>)cboCategories.SelectedItem).Key;
     Assembly assembly;
     switch (key)
     {
         case 1:
             assembly = Assembly.GetAssembly(typeof(AccountRepository));
             _displayClasses = assembly.GetTypes().Where(t => t.Namespace != null && t.IsClass && t.IsPublic).ToList();
             if (_displayClasses.Any())
             {
                 var uw = new DAL.DbEntity.UnitOfWork();
                 _constorInfoUniversal = new ConstructorInfo
                 {
                     ConstorParamType = new[] { uw.GetContext().GetType() },
                     ConstorParams = new[] { uw.GetContext() }
                 };
             }
             _bFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public;
             break;
         case 2:
             assembly = Assembly.GetAssembly(typeof(AccountRepositorySealed));
             //TekTak.iLoop.Sealed
             _displayClasses = assembly.GetTypes().Where(t => t.Namespace != null && t.Namespace.StartsWith("TekTak.iLoop.Sealed", StringComparison.OrdinalIgnoreCase) && t.IsClass && t.IsPublic).ToList();
             _constorInfoUniversal = _constorInfo;
             _bFlags = BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.Public;
             break;
         case 3:
             assembly = Assembly.GetAssembly(typeof(AccountService));
             _displayClasses = assembly.GetTypes().Where(t => t.Namespace != null && t.IsClass && t.IsPublic).ToList();
             if (_displayClasses.Any())
             {
                 var uw = new DAL.DbEntity.UnitOfWork();
                 var uow = new TekTak.iLoop.UOW.UnitOfWork();
                 _constorInfoUniversal = new ConstructorInfo
                 {
                     ConstorParamType = new[] { uw.GetType(), uow.GetType() },
                     ConstorParams = new object[] { uw, uow }
                 };
             }
             _bFlags = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public;
             break;
     }
     _cboItems = new Dictionary<string, string>();
     foreach (var type in _displayClasses)
     {
         var display = type.Name.IndexOf("Repo", StringComparison.Ordinal) > 0
             ? type.Name.Substring(0, type.Name.IndexOf("Repo", StringComparison.Ordinal))
             : type.Name;
         display = display.EndsWith("Service", StringComparison.OrdinalIgnoreCase) ? display.Substring(0, display.LastIndexOf("Service", StringComparison.OrdinalIgnoreCase)) : display;
         _cboItems.Add(type.FullName, display.AddSpaceBeforeCapitalLetters());
     }
     cboClasses.DataSource = new BindingSource(_cboItems, null);
     cboClasses.DisplayMember = "Value";
     cboClasses.ValueMember = "Key";
     cboClasses.SelectedIndex = 0;
 }