Beispiel #1
0
        public void initFramework()
        {
            var frameworkFactory = new FrameworkFactory();

            framework = frameworkFactory.CreateFramework();

            framework.Init();
            framework.Start();

            bundles = framework.GetBundleContext().GetBundles();
        }
Beispiel #2
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            //创建框架工厂
            var frameworkFactory = new FrameworkFactory();
            //创建框架内核
            var framework = frameworkFactory.CreateFramework();

            //初始化框架
            framework.Init();
            //启动框架
            framework.Start();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            //创建框架工厂
            var frameworkFactory = new FrameworkFactory();
            //创建框架内核
            var framework = frameworkFactory.CreateFramework();

            //初始化框架
            framework.Init();
            //启动框架
            framework.Start();

            Console.ReadLine();
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            //创建框架工厂
            var frameworkFactory = new FrameworkFactory();
            //创建框架内核
            var framework = frameworkFactory.CreateFramework();

            //初始化框架
            framework.Init();
            //启动框架
            framework.Start();

            BHOUserLoginOutDataProvider.Login("1", "2", "3", "4");


            Console.ReadLine();
        }
Beispiel #5
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            var frameworkFactory = new FrameworkFactory();

            Framework = frameworkFactory.CreateFramework();
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            IDictionary <String, ICommand> commandDict = new Dictionary <String, ICommand>();
            IList <ICommand> commandList = new List <ICommand>();

            var frameworkFactory = new FrameworkFactory();
            var framework        = frameworkFactory.CreateFramework();


            AppDomain.CurrentDomain.AssemblyLoad += CurrentDomainAssemblyLoad;
            framework.GetBundleContext().AddBundleListener(new ConsoleBundleListener());

            framework.Init();
            framework.Start();

            commandList.Add(new HelpCommand(commandDict));
            commandList.Add(new ListBundleCommand(framework));
            commandList.Add(new ListAssembliesCommand());
            commandList.Add(new StartBundleCommand(framework));
            commandList.Add(new StopBundleCommand(framework));
            commandList.Add(new InstallBundleCommand(framework));
            commandList.Add(new UninstallBundleCommand(framework));
            commandList.Add(new UpdateBundleCommand(framework));
            commandList.Add(new ExitCommand(framework));

            foreach (ICommand command in commandList)
            {
                commandDict.Add(command.GetCommandName(), command);
            }
            Console.WriteLine("------------------------------");
            Console.WriteLine("欢迎使用,输入help以查看帮助");
            Console.WriteLine("------------------------------");
            Console.WriteLine();

            while (true)
            {
                Console.Write("OSGi.NET>");
                var readLine = Console.ReadLine();
                if (readLine != null)
                {
                    String commandLine = readLine.Trim();
                    if (String.IsNullOrEmpty(commandLine))
                    {
                        continue;
                    }

                    String commandName = commandLine.Split(new Char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0];
                    if (commandDict.ContainsKey(commandName))
                    {
                        String result = null;
                        try
                        {
                            result = commandDict[commandName].ExecuteCommand(commandLine);
                            Console.WriteLine(result);
                        }
                        catch (Exception ex)
                        {
                            log.Error(String.Format("命令在执行过程中出现异常,信息:{0}", ex.Message), ex);
                        }
                    }
                    else
                    {
                        log.Error(String.Format("未知       命令:{0}", commandName));
                    }
                }
            }
        }