Ejemplo n.º 1
0
        public frmManager()
        {
            InitializeComponent();

            pm            = PackageManager.GetInstance();
            bm            = BoxsManager.GetInstance();
            serverService = ServicesFactory.GetInstance().GetServerService();
            enu           = bm.BoxsDictionary.GetEnumerator();
            dataGridView1.AllowUserToAddRows = false;

            DataGridViewDisableButtonColumn openCol = new DataGridViewDisableButtonColumn();

            openCol.Name = openColName;
            DataGridViewDisableButtonColumn deletePackageCol = new DataGridViewDisableButtonColumn();

            deletePackageCol.Name = deletePackageColName;
            DataGridViewDisableButtonColumn boxStateCol = new DataGridViewDisableButtonColumn();

            boxStateCol.Name = boxStateColName;

            dataGridView1.Columns.Add(openCol);
            dataGridView1.Columns.Add(deletePackageCol);
            dataGridView1.Columns.Add(boxStateCol);
            Initialize();
            UpdateData();
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            List <SpawnlistContract> spawnsList = ServerService.GetAllSpawns();

            spawnsList.ForEach((spawn) =>
            {
                L2Spawn l2Spawn =
                    new L2Spawn(NpcTable.Instance.GetTemplate(spawn.TemplateId))
                {
                    Location = new SpawnLocation(spawn.LocX, spawn.LocY, spawn.LocZ, spawn.Heading, spawn.RespawnDelay)
                };
                l2Spawn.Spawn(false);
                Spawns.Add(l2Spawn);
            });

            Log.Info($"SpawnTable: Spawned {spawnsList.Count} npcs.");

            if (Config.Config.Instance.GameplayConfig.NpcConfig.Misc.AutoMobRespawn)
            {
                RespawnTimerTask          = new Timer();
                RespawnTimerTask.Elapsed += new ElapsedEventHandler(RespawnTimerTick);
                RespawnTimerTask.Interval = 2000;
                RespawnTimerTask.Start();

                Log.Info($"SpawnTable: Started RespawnTimerTask.");
            }
        }
 public LoginWindow()
 {
     InitializeComponent();
     //serv = new ServerService("172.30.1.43", 8080);
     serv = new ServerService("125.209.222.141", 80);
     ServerService.sendLoginFrm = RecvData;
 }
Ejemplo n.º 4
0
        public void TestRun()
        {
            var type    = typeof(ServerService);
            var onStart = type.GetMethod("OnStart", BindingFlags.Instance | BindingFlags.NonPublic);
            var onStop  = type.GetMethod("OnStop", BindingFlags.Instance | BindingFlags.NonPublic);

            var mockWatchdog = new Mock <IWatchdog>();
            var args         = Array.Empty <string>();
            CancellationToken cancellationToken;

            mockWatchdog.Setup(x => x.RunAsync(args, It.IsAny <CancellationToken>())).Callback((string[] _, CancellationToken token) => cancellationToken = token).Returns(Task.CompletedTask).Verifiable();
            var mockWatchdogFactory = new Mock <IWatchdogFactory>();
            var mockLoggerFactory   = new LoggerFactory();

            mockWatchdogFactory.Setup(x => x.CreateWatchdog(mockLoggerFactory)).Returns(mockWatchdog.Object).Verifiable();

            using (var service = new ServerService(mockWatchdogFactory.Object, mockLoggerFactory))
            {
                onStart.Invoke(service, new object[] { args });

                Assert.IsFalse(cancellationToken.IsCancellationRequested);

                onStop.Invoke(service, Array.Empty <object>());
                Assert.IsTrue(cancellationToken.IsCancellationRequested);
                mockWatchdog.VerifyAll();
            }

            mockWatchdogFactory.VerifyAll();
        }
Ejemplo n.º 5
0
        public void RetornarDadosServidorTeste()
        {
            Guid id       = Guid.Parse("5C1BDC2F-033C-42D8-92CC-996294175C46");
            var  servidor = new ServerService(_configuration).RetornarDadosServidor(id);

            Assert.AreEqual(servidor.Id, id);
        }
Ejemplo n.º 6
0
        public void TestServerServiceCreateAccount()
        {
            var     userService            = new UserService();
            var     userConferenceService  = new UserConferenceService();
            var     adminConferenceService = new AdminConferenceService();
            var     proposalService        = new ProposalService();
            var     reviewService          = new ReviewService();
            var     ticketService          = new TicketService();
            var     enumService            = new EnumGetDataService();
            var     emailService           = new EmailService();
            var     sectionService         = new SectionService();
            var     serverService          = new ServerService(userService, userConferenceService, adminConferenceService, ticketService, emailService, proposalService, enumService, reviewService, sectionService);
            UserDTO userToAdd = new UserDTO()
            {
                Username   = "******",
                Password   = "******",
                FirstName  = "User",
                LastName   = "ForTest",
                Email      = "*****@*****.**",
                WebPage    = "test.ro",
                Admin      = true,
                Validation = "Waiting"
            };

            Assert.AreEqual(0, serverService.findAll().ToList().Count);
            var userSaved = serverService.createAccount(userToAdd);

            Assert.AreEqual(1, serverService.findAll().ToList().Count);
            Assert.AreEqual("UserForTest", serverService.findUser(userSaved.Id).Username);
            Assert.AreEqual("test.ro", userSaved.WebPage);
        }
Ejemplo n.º 7
0
        public SettingsWindow(
            ISettingsService settingsService,
            ServerService serverService,
            KeyService keyService,
            HttpClientService httpClientService
            )
        {
            Logger.Info("Creating settings window.");

            this.settingsService   = settingsService;
            this.serverService     = serverService;
            this.keyService        = keyService;
            this.httpClientService = httpClientService;

            RegisterServiceEventHandlers();
            InitializeComponent();
            InitializeAutoSplitTable();
            PopulateSettingsFileList(settingsService.SettingsFileCollection);

            // Unregister event handlers when we are done.
            Disposed += (sender, args) =>
            {
                Logger.Info("Disposing settings window.");
                UnregisterServiceEventHandlers();
            };

            ReloadComponentsWithCurrentSettings(settingsService.CurrentSettings);

            // Loading the settings will dirty mark pretty much everything, here
            // we just verify that nothing has actually changed yet.
            MarkClean();
        }
Ejemplo n.º 8
0
        public void TestServerServiceUpdateAccount()
        {
            var userService            = new UserService();
            var userConferenceService  = new UserConferenceService();
            var adminConferenceService = new AdminConferenceService();
            var proposalService        = new ProposalService();
            var reviewService          = new ReviewService();
            var ticketService          = new TicketService();
            var enumService            = new EnumGetDataService();
            var emailService           = new EmailService();
            var sectionService         = new SectionService();
            var serverService          = new ServerService(userService, userConferenceService, adminConferenceService, ticketService, emailService, proposalService, enumService, reviewService, sectionService);

            PrepareData();


            Assert.AreEqual(4, serverService.findAll().ToList().Count);
            var userForUpdate = serverService.findUser(1);

            userForUpdate.FirstName = "Pop";
            userForUpdate.LastName  = "Mihai";
            userForUpdate.Username  = "******";

            var updatedUser      = serverService.updateAccount(userForUpdate);
            var userFromDataBase = serverService.findUser(updatedUser.Id);

            Assert.AreEqual(4, serverService.findAll().ToList().Count);
            Assert.AreEqual("Pop", updatedUser.FirstName);
            Assert.AreEqual("Mihai", updatedUser.LastName);
            Assert.AreEqual("Updated", updatedUser.Username);
            Assert.AreEqual("Pop", userFromDataBase.FirstName);
            Assert.AreEqual("Mihai", userFromDataBase.LastName);
            Assert.AreEqual("Updated", userForUpdate.Username);
        }
Ejemplo n.º 9
0
        public void TestServerServiceFindUser()
        {
            PrepareData();
            var userService            = new UserService();
            var userConferenceService  = new UserConferenceService();
            var adminConferenceService = new AdminConferenceService();
            var proposalService        = new ProposalService();
            var reviewService          = new ReviewService();
            var ticketService          = new TicketService();
            var enumService            = new EnumGetDataService();
            var emailService           = new EmailService();
            var sectionService         = new SectionService();
            var serverService          = new ServerService(userService, userConferenceService, adminConferenceService, ticketService, emailService, proposalService, enumService, reviewService, sectionService);

            var user1 = serverService.findUser(1);
            var user3 = serverService.findUser(3);

            Assert.AreEqual("User1", user1.Username);
            Assert.AreEqual("User3", user3.Username);
            Assert.AreEqual("Last1", user1.LastName);
            Assert.AreEqual("Last3", user3.LastName);
            Assert.AreEqual("First1", user1.FirstName);
            Assert.AreEqual("First3", user3.FirstName);
            Assert.AreEqual(true, user1.Admin);
            Assert.AreEqual(false, user3.Admin);
        }
Ejemplo n.º 10
0
        public DatabaseHandler(DiscordShardedClient client, LogsService logs, ServerService server, UserService user) : base(client, logs)
        {
            _server = server;
            _user   = user;

            _isBusy = true;
        }
        public ServerAppServiceUnitTest()
        {
            IServerRepository serverRepository = new IServerRepositoryMock().Setup();
            IServerService    serverService    = new ServerService(serverRepository);

            serverAppService = new ServerAppService(serverService);
        }
Ejemplo n.º 12
0
        // Constructor
        public MainPage()
        {
            
            InitializeComponent();
            ser = new NotificationClass();
            obj = new Notification(ser);

            //NotificationSwitch is set by user to start or stop push notifications.
            if (IsolatedStorageSettings.ApplicationSettings.Contains("notificationSwitch"))
            {
                //If notificationSwitch is ON(True) then only start notification service.
                if ((bool)IsolatedStorageSettings.ApplicationSettings["notificationSwitch"])
                {
                    //Start in-app Notification listening every time application starts.
                    obj.SetupNotification();
                }
            }
            else
            {
                //By Default Notifications are disabled.
                IsolatedStorageSettings.ApplicationSettings["notificationSwitch"] = false;
            }

            
        }
Ejemplo n.º 13
0
        public async Task <IActionResult> University(AuthConfig config)
        {
            if (!ModelState.IsValid)
            {
                config.University = await GetClaimedUniversity(await GetCurrentUserAsync(), config.UniversityId);

                return(View("ManageUniversity", config));
            }

            var authConfigService = new AuthConfigService(new SqlAuthConfigRepository(_dbContext), _samlConfigurations);
            await authConfigService.SaveAsync(config);

            var universityService = new UniversityService(new SqlUniversityRepository(_dbContext));
            var claimedUniversity = await universityService.FindByIdAsync(config.UniversityId);

            var serverService = new ServerService(new SqlServerRepository(_dbContext));
            await serverService.EnableAuthAsync(claimedUniversity.Server);

            var membershipService = new MembershipService(new SqlMembershipRepository(_dbContext));

            foreach (var channel in claimedUniversity.Server.Channels)
            {
                await membershipService.DropMembershipsAsync(channel);
            }

            return(RedirectToAction(nameof(Index), new { Message = ManageMessageId.ManageUniversitySuccess }));
        }
Ejemplo n.º 14
0
        private static void testSend()
        {
            BloodSettings info = new BloodSettings();

            info.dump          = new Dump();
            info.SN            = "z320190120";
            info.sim           = "15928882400";
            info.inf_query     = "BI";
            info.model_setup   = "Z3";
            info.reagent_setup = "OPEN";
            info.oem_change    = 1;
            info.agent_change  = 1;
            info.lang_change   = "chinese";
            info.sn_setup      = "Z3201801001";
            info.remote_shut   = "close";
            info.dump.encoding = "base64";
            info.dump.filename = "update.tar.gz";
            info.dump.data     = "";

            string testId = SocketServer.SocketServer.testIds.Count > 0 ? SocketServer.SocketServer.testIds[0] : "当前没有连接";

            ServerService service = new ServerService();
            ResultInfo    ri      = service.updateBloodParas(testId, info);

            Console.WriteLine(ri.msg);
        }
Ejemplo n.º 15
0
        public void ValidarDispobilidadeServidorTeste()
        {
            Guid id       = Guid.Parse("5C1BDC2F-033C-42D8-92CC-996294175C46");
            var  mensagem = new ServerService(_configuration).ValidarDisponibilidadeServidor(id);

            Assert.AreNotEqual(string.IsNullOrEmpty(mensagem), true);
        }
Ejemplo n.º 16
0
        public ActionResult Index()
        {
            string userName = this.GetCookieValue("username");
            string cityId   = this.GetCookieValue("cityid");
            string serverId = this.GetCookieValue("serverid");
            string systemId = this.GetCookieValue("systemid");
            string localip  = this.ControllerContext.HttpContext.Request.UserHostAddress;

            if (!cityId.Equals(string.Empty) && !serverId.Equals(string.Empty) && !systemId.Equals(string.Empty) && UserService.CheckAdress(userName, localip))
            {
                ViewBag.CityName   = CityService.GetCityByCityID(cityId).ToString();
                ViewBag.ServerName = ServerService.GetServerById(serverId).ToString();
                ViewBag.SystemName = SystemService.GetSystemById(systemId).ToString();
                ViewBag.userName   = userName;
                ViewBag.localip    = localip;
            }
            else
            {
                this.RemoveCookie(cityId);
                this.RemoveCookie(serverId);
                this.RemoveCookie(systemId);
                this.RemoveCookie(userName);
                FormsService.SignOut();
                if (this.ControllerContext.HttpContext.Request.IsAuthenticated)
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            Session["userName"] = userName;
            return(View());
        }
Ejemplo n.º 17
0
        public void Run()
        {
            Console.Title = "Server: " + _serverId;
            Console.WriteLine("Running base version");
            var freezeUtilities       = new FreezeUtilities();
            var serverParameters      = UrlParameters.From(_serverUrl);
            var serverService         = new ServerService(_storage, freezeUtilities, _serverUrl, DelayMessage);
            var nodeService           = new NodeService(freezeUtilities, DelayMessage, RegisterServers, RegisterPartitions);
            var registerSlavesService = new SlaveRegisteringService(_storage);

            AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
            var server = new Grpc.Core.Server {
                Services =
                {
                    DIDAService.BindService(serverService),
                    NodeControlService.BindService(nodeService),
                    RegisterSlaveToMasterService.BindService(registerSlavesService),
                    BaseSlaveService.BindService(new BaseSlaveServerService(_storage))
                },
                Ports =
                {
                    new ServerPort(serverParameters.Hostname,
                                   serverParameters.Port, ServerCredentials.Insecure)
                }
            };

            server.Start();
            Console.WriteLine("Server " + _serverId + " listening on port " + serverParameters.Port);
            ReadCommands();

            server.ShutdownAsync().Wait();
        }
Ejemplo n.º 18
0
 public ServersController(IServerRepository repo, ServerService service, LogService logService, ServerDetailService serverDetailService)
 {
     _service             = service;
     _logService          = logService;
     _serverDetailService = serverDetailService;
     _repo = repo;
 }
Ejemplo n.º 19
0
        private void PopulateSelectListsToModel(BindingViewModel viewModel, IBinding binding)
        {
            if (viewModel != null)
            {
                if (viewModel.SelectedWebsiteId > 0)
                {
                    binding.Website = WebsiteService.GetById(viewModel.SelectedWebsiteId);
                }

                if (viewModel.SelectedServerIds.Any())
                {
                    if (binding.Servers == null)
                    {
                        binding.Servers = new HashSet <IServer>();
                    }
                    foreach (long selectedServerId in viewModel.SelectedServerIds)
                    {
                        binding.Servers.Add(ServerService.GetById(selectedServerId));
                    }
                }
                if (viewModel.SelectedEnvironmentIds.Any())
                {
                    if (binding.Environments == null)
                    {
                        binding.Environments = new HashSet <IEnvironment>();
                    }
                    foreach (long selectedEnvironmentId in viewModel.SelectedEnvironmentIds)
                    {
                        binding.Environments.Add(EnvironmentService.GetById(selectedEnvironmentId));
                    }
                }
            }
        }
Ejemplo n.º 20
0
        static void RunApplication()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            using (var settingsService = CreateSettingsService())
                using (var gameService = new GameService(settingsService))
                {
                    CheckForApplicationUpdates(settingsService);

                    new CharacterStatFileWriterService(settingsService, gameService);
                    var keyService        = new KeyService();
                    var autoSplitService  = new AutoSplitService(settingsService, gameService, keyService);
                    var serverService     = new ServerService(gameService, settingsService);
                    var httpClientService = new HttpClientService(gameService, settingsService);
                    var mainWindow        = new MainWindow(
                        settingsService,
                        gameService,
                        autoSplitService,
                        keyService,
                        serverService,
                        httpClientService
                        );
                    Application.Run(mainWindow);

                    serverService.Stop();
                }
        }
Ejemplo n.º 21
0
        public LoginPage()
        {
            InitializeComponent();

            var _serverConnect = new ServerService();
            BindingContext = new LoginPageViewModel(_serverConnect);
        }
Ejemplo n.º 22
0
 private void button4_Click(object sender, RoutedEventArgs e)
 {
     //中转服
     Server = new ServerService(TestData.ServerHost, TestData.ServerPort);
     Server.SetOuter(tb_out);
     Server.Listen();
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Guarda o modifica la imagen
        /// </summary>
        /// <param name="imagenVehiculo"></param>
        /// <returns>ServerResponseImagenVehiculo</returns>
        public ServerResponseImagenVehiculo SaveDocument(ImagenVehiculo imagenVehiculo)
        {
            ServerResponseImagenVehiculo serverResponseImagenVehiculo = null;

            try
            {
                OauthToken oauthToken = ServerService.obtenerToken();

                if (null != oauthToken)
                {
                    var url = Constantes.SERVIDOR + VEHICULO + "savedoc";

                    var httpRequest = (HttpWebRequest)WebRequest.Create(url);
                    httpRequest.Method = "POST";

                    httpRequest.Headers["Authorization"] = "Bearer " + oauthToken.access_token;
                    httpRequest.ContentType = "application/json";

                    var data = JsonSerializer.Serialize <ImagenVehiculo>(imagenVehiculo);

                    using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream()))
                    {
                        streamWriter.Write(data);
                    }

                    var httpResponse = (HttpWebResponse)httpRequest.GetResponse();
                    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                    {
                        var result = streamReader.ReadToEnd();

                        serverResponseImagenVehiculo = JsonSerializer.Deserialize <ServerResponseImagenVehiculo>(result);
                    }

                    //Console.WriteLine(httpResponse.StatusCode);
                }
                else
                {
                    serverResponseImagenVehiculo = new ServerResponseImagenVehiculo();

                    ErrorBean error = new ErrorBean();
                    error.code    = MessageExceptions.SERVER_ERROR;
                    error.message = MessageExceptions.MSSG_SERVER_ERROR;

                    serverResponseImagenVehiculo.error = error;
                }
            }
            catch (System.Exception)
            {
                serverResponseImagenVehiculo = new ServerResponseImagenVehiculo();

                ErrorBean error = new ErrorBean();
                error.code    = MessageExceptions.SERVER_ERROR;
                error.message = MessageExceptions.MSSG_SERVER_ERROR;

                serverResponseImagenVehiculo.error = error;
            }

            return(serverResponseImagenVehiculo);
        }
Ejemplo n.º 24
0
        private void buttonDonate_Click(object sender, EventArgs e)
        {
            if (dataGridViewDonors.SelectedRows.Count == 0 || dataGridViewCases.SelectedRows.Count == 0)
            {
                MessageBox.Show("Please select a row from donors and one from cases!");
            }
            else
            {
                try
                {
                    int    caseId      = Int32.Parse(dataGridViewCases.SelectedRows[0].Cells["CaseId"].Value.ToString());
                    double sumToDonate = Double.Parse(textBoxSumToDonate.Text);
                    int    donorId     = 0;
                    if (dataGridViewDonors.SelectedRows[0].Cells["DonorName"].Value.ToString() == textBoxDonorName.Text)
                    {
                        donorId = Int32.Parse(dataGridViewDonors.SelectedRows[0].Cells["DonorId"].Value.ToString());
                    }
                    else
                    {
                        string   name        = textBoxDonorName.Text;
                        string   address     = textBoxDonorAddress.Text;
                        string   phoneNumber = textBoxDonorPhoneNumber.Text;
                        Response response    = ServerService.addDonor(new Donor {
                            Id = 0, Address = address, Name = name, PhoneNumber = phoneNumber
                        });
                        try
                        {
                            if (response.Type == Response.Types.Type.Error)
                            {
                                throw new Exception("Cannot add donor!");
                            }

                            donorId = response.Did;
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                    try
                    {
                        Observer.RequestStream.WriteAsync(new Donation()
                        {
                            Did        = donorId,
                            Cid        = caseId,
                            SumDonated = sumToDonate
                        });
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Data not inserted corectly!\n" + ex);
                }
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Posts the archived roleplay to the guild's archive channel, if it has one.
        /// </summary>
        /// <param name="guild">The guild.</param>
        /// <param name="serverService">The server service.</param>
        /// <param name="serverSettings">The server settings service.</param>
        /// <param name="roleplay">The roleplay.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        private async Task PostArchivedRoleplayAsync
        (
            SocketGuild guild,
            ServerService serverService,
            RoleplayServerSettingsService serverSettings,
            Roleplay roleplay
        )
        {
            var getServer = await serverService.GetOrRegisterServerAsync(guild);

            if (!getServer.IsSuccess)
            {
                this.Log.LogWarning("Failed to get the server for the current guild. Bug?");
                return;
            }

            var server = getServer.Entity;

            var getSettings = await serverSettings.GetOrCreateServerRoleplaySettingsAsync(server);

            if (!getSettings.IsSuccess)
            {
                this.Log.LogWarning("Failed to get the server settings for the current guild. Bug?");
                return;
            }

            var settings = getSettings.Entity;

            if (settings.ArchiveChannel is null)
            {
                return;
            }

            var archiveChannel = guild.GetTextChannel((ulong)settings.ArchiveChannel);

            if (archiveChannel is null)
            {
                this.Log.LogWarning("Failed to get the archive channel for the current guild. Deleted?");
                return;
            }

            var exporter = new PDFRoleplayExporter(guild);

            using var exportedRoleplay = await exporter.ExportAsync(roleplay);

            var eb = _feedback.CreateEmbedBase();

            eb.WithTitle($"{exportedRoleplay.Title} - Archived");
            eb.WithDescription(roleplay.Summary);
            eb.WithFooter($"Archived on {DateTime.Now:d}.");

            await archiveChannel.SendFileAsync
            (
                exportedRoleplay.Data,
                $"{exportedRoleplay.Title}.{exportedRoleplay.Format.GetFileExtension()}",
                string.Empty,
                embed : eb.Build()
            );
        }
Ejemplo n.º 26
0
        public void ReturnsErrorIfJoinMessageIsEmpty()
        {
            _server.JoinMessage = string.Empty;

            var result = ServerService.GetJoinMessage(_server);

            Assert.False(result.IsSuccess);
        }
Ejemplo n.º 27
0
        private void Response(CallPackage cp)
        {
            var _client = awaitResponses.FirstOrDefault(x => x.Key == cp.Guid).Value;

            ServerService.Call(cp, _client);

            _logger.LogDebug("response " + cp.Data);
        }
Ejemplo n.º 28
0
        public void ReturnsErrorIfJoinMessageIsWhitespace()
        {
            _server.JoinMessage = "      ";

            var result = ServerService.GetJoinMessage(_server);

            Assert.False(result.IsSuccess);
        }
Ejemplo n.º 29
0
 protected override void OnStart(string[] args)
 {
     ORMConfig.RegisterORM();
     _taskService   = new TaskService();
     _serverService = new ServerService();
     _serverService.Register();
     _taskService.StartUp();
 }
Ejemplo n.º 30
0
 public CameraController(ServerService serverService, Regulator regulator)
 {
     this.serverService = serverService;
     Regulator          = regulator;
     observers          = new HashSet <Helpers.IObserver <Position> >();
     path  = new Queue <Point>();
     Theta = -1;  // Not Set
 }
Ejemplo n.º 31
0
 public RobotModel(string ip, int port)
 {
     socket    = new TcpClient();
     IP        = ip;
     this.port = port;
     //Regulator = new Regulator();
     ServerService = new ServerService();
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Will send the log message
 /// </summary>
 /// <param name="message">the message</param>
 /// <param name="type">the type</param>
 internal static void OnLogMessage(string message, ServerService.Logging.MessageType type)
 {
     if (LogMessage != null)
         LogMessage(
             null,
             new ServerService.Logging.LogMessageEventArgs
             {
                 message = message,
                 type = type
             });
 }
Ejemplo n.º 33
0
		public static async Task SetServerSubscriptions(this DartAnalysisService service, ServerService[] subscriptions)
		{
			var request = new ServerSetSubscriptionsRequest
			{
				Subscriptions = subscriptions
			};

			var response = await service
				.Service.Send(new ServerSetSubscriptions(request))
				.ConfigureAwait(continueOnCapturedContext: false);

			// There's nothing useful on this response to return.

			return;
		}
Ejemplo n.º 34
0
	void Awake ()
	{
		initialized = false;
		System.DateTime time = System.DateTime.Now;
		instance = this;

		server = ServerHandler.server;

		if (!StaticData.OnlineVistoria) {
			vistoriaDAO = ServerHandler.vistoriaDAO;
			servicoDAO = ServerHandler.servicoDAO;
			ambienteDAO = ServerHandler.ambienteDAO;
			indicadorDAO = ServerHandler.indicadorDAO;
			imagemIndicadorDAO = ServerHandler.imagemIndicadorDAO;
			LoadOfflineData ();
		} else {
			LoadOnlineData ();
		}
	
	}
Ejemplo n.º 35
0
        private void RegisterServices()
        {
            var endpoint = loginSettings.Endpoint;

            var serverUserService = new UserService(endpoint);

            Guid sessionId;

            using (var channelManager = serverUserService.CreateChannelManager())
            using (var channel = channelManager.CreateChannel())
            {
                var currentUser = channel.Service.UserLogin(loginSettings.User, loginSettings.Password).Result as Administrator;
                sessionId = currentUser.SessionId;
                Container.RegisterInstance(currentUser);
            }

            Container.RegisterInstance(serverUserService);
            Container.RegisterType<ChannelManager<IServerTcpService>>
                (new InjectionFactory(c => serverUserService.CreateChannelManager(sessionId)));

            var serverService = new ServerService(endpoint);
            Container.RegisterInstance(serverService);
            Container.RegisterType<ChannelManager<IServerTcpService>>
                (new InjectionFactory(c => serverService.CreateChannelManager(sessionId)));

            var queuePlanService = new QueuePlanService(endpoint);
            Container.RegisterInstance(queuePlanService);
            Container.RegisterType<DuplexChannelManager<IQueuePlanTcpService>>
                (new InjectionFactory(c => queuePlanService.CreateChannelManager(sessionId)));

            var templateService = new TemplateService(endpoint);
            Container.RegisterInstance(templateService);
            Container.RegisterType<ChannelManager<ITemplateTcpService>>
                (new InjectionFactory(c => templateService.CreateChannelManager(sessionId)));

            var theme = string.IsNullOrEmpty(portalSettings.Theme)
                ? Templates.Themes.Default : portalSettings.Theme;

            var templateManager = new TemplateManager(Templates.Apps.Common, theme);
            Container.RegisterInstance<ITemplateManager>(templateManager);
        }
Ejemplo n.º 36
0
	void Start ()
	{
		if(StaticData.IsRelog)
		{
			if(ServerHandler.server != null)
				server = ServerHandler.server ;
			else
			{
				ServerHandler.server = new ServerService ();
				server = ServerHandler.server ;
			}

			Relog();
		}
		else
		{
			ShowLoginScreen ();	
			isConnected = ConnectionManager.IsConnected (false);

			if (isConnected && !offlineMode) {
				if(ServerHandler.server == null)
					ServerHandler.server = new ServerService ();

				server = ServerHandler.server ;
				Invoke("DownloadVistoriadores" , 0.4f);
			}
			else
			{
				List<Vistoriador> list = ServerHandler.vistoriadorDAO.LoadAllIncludingDeleted();
				if(list.Count == 0)
				{
					Vistoriador vistoriadorPadrao = new Vistoriador();
					vistoriadorPadrao.nome = "Master";
					vistoriadorPadrao.usuario = "admin";
					vistoriadorPadrao.senha = "1234";
					ServerHandler.vistoriadorDAO.SaveOrUpdate(vistoriadorPadrao);
				}
			}
		}
	}
Ejemplo n.º 37
0
 /// <summary>
 /// Creates a Notification Service and link it with web Service.
 /// </summary>
 public Notification(ServerService serverService)
 {
     server = serverService;
 }
Ejemplo n.º 38
0
        private async Task<bool> ConnectionValid()
        {
            try
            {
                using (var service = new ServerService(Endpoint))
                using (var channelManager = service.CreateChannelManager())
                using (var channel = channelManager.CreateChannel())
                {
                    var date = await channel.Service.GetDateTime();
                }

                return true;
            }
            catch (Exception e)
            {
                UIHelper.Error(null, "Не удалось подключиться к серверу", e);
            }

            return false;
        }
Ejemplo n.º 39
0
 public ServerWorkSpaceViewModel (IUnityContainer container, ServerService serverService ) : base(container)
 {
     mServerService = serverService;
     BindingOperations.EnableCollectionSynchronization(Servers,LockObject);
     Init();
 }
Ejemplo n.º 40
0
        private static void RegisterServices()
        {
            serverService = new ServerService(endpoint);
            container.RegisterInstance(serverService);
            container.RegisterType<ChannelManager<IServerTcpService>>
                (new InjectionFactory(c => serverService.CreateChannelManager(sessionId)));

            userService = new UserService(endpoint);
            container.RegisterInstance(userService);
            container.RegisterType<ChannelManager<IUserTcpService>>
                (new InjectionFactory(c => userService.CreateChannelManager(sessionId)));

            templateService = new TemplateService(endpoint);
            container.RegisterInstance(templateService);
            container.RegisterType<ChannelManager<ITemplateTcpService>>
                (new InjectionFactory(c => templateService.CreateChannelManager(sessionId)));

            workplaceService = new WorkplaceService(endpoint);
            container.RegisterInstance(workplaceService);
            container.RegisterType<ChannelManager<IWorkplaceTcpService>>
                (new InjectionFactory(c => workplaceService.CreateChannelManager(sessionId)));

            queuePlanService = new QueuePlanService(endpoint);
            container.RegisterInstance(queuePlanService);
            container.RegisterType<DuplexChannelManager<IQueuePlanTcpService>>
                (new InjectionFactory(c => queuePlanService.CreateChannelManager(sessionId)));

            lifeSituationService = new LifeSituationService(endpoint);
            container.RegisterInstance(lifeSituationService);
            container.RegisterType<ChannelManager<ILifeSituationTcpService>>
                (new InjectionFactory(c => lifeSituationService.CreateChannelManager(sessionId)));

            var theme = string.IsNullOrEmpty(administratorSettings.Theme)
                ? Templates.Themes.Default : administratorSettings.Theme;

            templateManager = new TemplateManager(Templates.Apps.Common, theme);
            container.RegisterInstance<ITemplateManager>(templateManager);
        }
Ejemplo n.º 41
0
        private void RegisterServices()
        {
            serverService = new ServerService(AppSettings.Endpoint);
            templateService = new TemplateService(AppSettings.Endpoint);
            displayService = new DisplayService(HubSettings.Endpoint);
            queuePlanService = new QueuePlanService(AppSettings.Endpoint);

            UnityContainer.RegisterInstance(serverService)
                         .RegisterInstance(templateService)
                         .RegisterInstance(displayService)
                         .RegisterInstance(queuePlanService);
        }
Ejemplo n.º 42
0
        private void RegisterServices()
        {
            serverService = new ServerService(AppSettings.Endpoint);
            userService = new UserService(AppSettings.Endpoint);
            templateService = new TemplateService(AppSettings.Endpoint);
            lifeSituationService = new LifeSituationService(AppSettings.Endpoint);

            UnityContainer.RegisterInstance(serverService)
                        .RegisterInstance(userService)
                        .RegisterInstance(templateService)
                        .RegisterInstance(lifeSituationService);
        }
Ejemplo n.º 43
0
        private static void RegisterServices()
        {
            qualityService = new QualityService(hubSettings.Endpoint);
            container.RegisterInstance(qualityService);
            container.RegisterType<DuplexChannelManager<IQualityTcpService>>
                (new InjectionFactory(c => qualityService.CreateChannelManager()));

            serverService = new ServerService(endpoint);
            container.RegisterInstance(serverService);
            container.RegisterType<ChannelManager<IServerTcpService>>
                (new InjectionFactory(c => serverService.CreateChannelManager(sessionId)));

            userService = new UserService(endpoint);
            container.RegisterInstance(userService);
            container.RegisterType<ChannelManager<IUserTcpService>>
                (new InjectionFactory(c => userService.CreateChannelManager(sessionId)));

            queuePlanService = new QueuePlanService(endpoint);
            container.RegisterInstance(queuePlanService);
            container.RegisterType<DuplexChannelManager<IQueuePlanTcpService>>
                (new InjectionFactory(c => queuePlanService.CreateChannelManager(sessionId)));
        }
Ejemplo n.º 44
0
	public void testFindIndicador () {
		ServerService server = new ServerService ();
		string key = "3_Sala_CERAMICA";
		string json = server.findIndicadorByVistoriaAndAmbienteAndServico (key);
		print (json);
	}
Ejemplo n.º 45
0
        private void RegisterServices()
        {
            serverService = new ServerService(AppSettings.Endpoint);
            workplaceService = new WorkplaceService(AppSettings.Endpoint);
            queuePlanService = new QueuePlanService(AppSettings.Endpoint);

            UnityContainer.RegisterInstance(serverService)
                            .RegisterInstance(workplaceService)
                            .RegisterInstance(queuePlanService);
        }
Ejemplo n.º 46
0
        public IPFilter(ref ServerService.Statistics Stats)
        {
            statistics = Stats;

            InitializeComponent();
        }