public void initFlightBoard() { MainViewVM mv = MainViewVM.Instance; this.isr = mv.isr; isr.PropertyChanged += PropertyChange; }
public static SqlConnection ChaneConnection(InfoServer infoServer) { InfoServer = infoServer; connection = new SqlConnection(new SqlProvider().CreatConnectString(InfoServer.NameServer, InfoServer.Database, InfoServer.UseAccount ? InfoServer.Username : null, InfoServer.UseAccount ? InfoServer.Password : null)); return(connection); }
public static void Exit(bool restarting, string msg) { Player[] players = PlayerInfo.Online.Items; foreach (Player p in players) { p.save(); } foreach (Player p in players) { p.Leave(msg); } if (APIServer != null) { APIServer.Stop(); } if (InfoServer != null) { InfoServer.Stop(); } Player.connections.ForEach(p => p.Leave(msg)); Plugin.Unload(); if (listen != null) { listen.Close(); } try { IRC.Disconnect(restarting ? "Server is restarting." : "Server is shutting down."); } catch { } }
public void Connect() { // Set the server Task taskSever = new Task(() => { InfoServer.SetServer(); InfoServer.Start(); }); Task taskClient = new Task(() => { CommandChannel.AssignSocket(); }); Task connectionFlow = new Task(() => { taskSever.Start(); taskSever.Wait(); Console.WriteLine("Finished waiting as server"); taskClient.Start(); taskClient.Wait(); }); connectionFlow.Start(); }
public MapModel() { IClientHandler ch = new ClientHandler(this); InfoServer.RegisterClientHandler(ch); Console.WriteLine("flightboard connected as client"); }
private void btnNext_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(cmbServer.Text)) { MessageBox.Show("Nhập tên server!", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } else { string sConnect = ""; if (cbAccount.Checked) { if (string.IsNullOrWhiteSpace(txtUsername.Text) || string.IsNullOrWhiteSpace(txtPassword.Text)) { MessageBox.Show("Nhập đầy đủ Username và Password!", "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); return; } else { sConnect = new SqlProvider().CreatConnectString(cmbServer.Text, null, txtUsername.Text, txtPassword.Text); } } else { sConnect = new SqlProvider().CreatConnectString(cmbServer.Text, null, null, null); } try { SqlConnection con = new SqlConnection(sConnect); con.Open(); con.Close(); var info = new InfoServer() { NameServer = cmbServer.Text, Username = txtUsername.Text, Password = txtPassword.Text, UseAccount = cbAccount.Checked, Database = null }; string tmp = null; if (Common.InfoServer != null) { tmp = Common.InfoServer.Database; } Common.ChaneConnection(info); info.Database = tmp; Common.SaveInfoServer(info); if (Common.LstServer.Count == 0 || !Common.LstServer.Any(q => q.Trim().ToLower().Equals(cmbServer.Text.Trim().ToLower()))) { Common.AddListServer(cmbServer.Text); } this.Close(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message, "Lỗi", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } } }
public FlightBoardViewModel() { infoServer = InfoServer.Instance; // sign to get notifactions from the server infoServer.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged(e.PropertyName); }; }
public static void InitLayerServer() { Info = new InfoServer(); Info.Init(); Request = new RequestServer(); Request.Init(); Behavior = new BehaviorServer(); Behavior.Init(); }
private void UpdateInfoServer(string mConnInfo, GetDevice decServInfo, InfoServer infoServer) { decServInfo.Hk = mConnInfo; infoServer.Code = Cypher.Encrypt(new JavaScriptSerializer().Serialize(decServInfo)); _repository.SaveChanges(); //if (infoServer.InfoCallCenterId.HasValue == false) // return; }
public void startServerVM() { cs = CommandServer.Instance; isr = InfoServer.Instance; isr.Connect(); cs.Start(); FlightBoardViewModel fbvm = FlightBoardViewModel.Instance; fbvm.initFlightBoard(); }
public Position GetPosition() { InfoServer server = InfoServer.Instance; string lat = server.Get("position/latitude-deg"); string lon = server.Get("position/longitude-deg"); string throttle = server.Get("controls/engines/current-engine/throttle"); string rudder = server.Get("controls/flight/rudder"); Position pos = new Position(Double.Parse(lon), Double.Parse(lat), Double.Parse(throttle), Double.Parse(rudder)); return(pos); }
private void OnConnectClick() { new Thread(() => { //init communication InfoServer server = InfoServer.Instance; server.Start(); CommandClient commandClient = CommandClient.Instance; commandClient.Start(); }).Start(); }
public ActionResult save(string ip, int port, int rate, int duration, string name) { CacheManager.Instance.Path = name; System.IO.File.WriteAllBytes(CacheManager.Instance.Path, new byte[0]); InfoServer server = InfoServer.Instance; server.Start(ip, port); Session["rate"] = rate; Session["duration"] = duration; return(View()); }
public ActionResult pathOnMap(string ip, int port, int rate) { InfoServer server = InfoServer.Instance; if (server.booleanState()) { server.Stop(); } server.Start(ip, port); Session["rate"] = rate; return(View()); }
private bool IsUpdatedInfoServer(string mConnInfo, InfoServer infoServer, out GetDevice decCompInfo) { var connInfo = mConnInfo; decCompInfo = new JavaScriptSerializer().Deserialize <GetDevice>(Cypher.Decrypt(infoServer.Code)); if (connInfo == decCompInfo.Hk) { return(true); } return(false); }
public ActionResult display(string ip, int port) { IPAddress temp; if (IPAddress.TryParse(ip, out temp) == false) { load(ip, port); return(View("load")); } InfoServer server = InfoServer.Instance; if (server.booleanState()) { server.Stop(); } server.Start(ip, port); Position pos = GetPosition(); Lat = pos.Lat; Lon = pos.Lon; return(View()); }
internal static void SaveInfoServer(InfoServer infoServer) { InfoServer = infoServer; InfoServer.Save(FILE_INFOSERVER); }
public FlightBoardViewModel(InfoServer server1) { server = server1; Globals.telnetClient = new ConnectTelnetClient(); server.PropertyChanged += m_PropertyChanged; }
internal static void ReadInfoServer() { InfoServer = new InfoServer().Read(FILE_INFOSERVER); }