Пример #1
0
        static int Main()
        {
            BasicConfigurator.Configure();
            InitParams initParams = new InitParams {UseLoopbackNetworkAdapter = true};
            string nodeGuid = Guid.NewGuid().ToString();
            using (Library library = Library.Create(initParams))
            {
                SubnetList subnetList = new SubnetList();
                NetworkAdapter nif = subnetList.SubnetAt(0);
                uint subnet = nif.Subnet();
                subnetList.Dispose();
                var combinedStack = library.StartCombined(subnet);
                AppServices services = new AppServices
                                           {
                                               NodeRebooter = new NullNodeRebooter(),
                                               DeviceFactory = new DvDeviceFactory(combinedStack.DeviceStack)
                                           };
                string exePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                string storePath = Path.Combine(exePath, "test-store");
                ConfigFileCollection config = new ConfigFileCollection(new string[] { });
                config.AddFile("config.xml",
                    new XElement("ohos",
                        new XElement("system-settings",
                            new XElement("store", storePath)
                        )
                    )
                );
                if (Directory.Exists(storePath))
                {
                    Directory.Delete(storePath, true);
                }
                using (var installModule = new AppShellModule(services, config, null, nodeGuid))
                {
                    installModule.AppShell.Start();

                    installModule.AppShell.Install(Path.Combine(exePath, "ohOs.TestApp1.zip"));

                    List<AppInfo> apps = installModule.AppShell.GetApps().ToList();
                    if (apps.Count!=1)
                    {
                        Console.Error.WriteLine("There should be one app installed. (Found {0}.)", apps.Count);
                        return 1;
                    }
                    if (apps[0].Name!="ohOs.TestApp1")
                    {
                        Console.Error.WriteLine("Wrong app name. (Got '{0}'.)", apps[0].Name);
                        PrintAppState(apps[0]);
                        return 1;
                    }
                    if (apps[0].State!=AppState.Running)
                    {
                        Console.Error.WriteLine("App should be running. (It isn't.)");
                        PrintAppState(apps[0]);
                        return 1;
                    }

                }
            }
            return 0;
        }
Пример #2
0
 public TimerExpired(AppServices.Game.Base.ISelect selectGame,
                     AppServices.GamePlayerCard.Base.IPlay playCard,
                     AppServices.Hubs.Base.ISendMessage sendMessage,
                     AppServices.GamePlayer.Base.IUpdate updateGamePlayer)
 {
     this._selectGame = selectGame;
     this._playCard = playCard;
     this._sendMessage = sendMessage;
     this._updateGamePlayer = updateGamePlayer;
 }