Exemple #1
0
 void Application_Start(object sender, EventArgs e)
 {
     // Code that runs on application startup
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     ServerWebSocket ServerSocket = ServerWebSocket.Instance;
 }
Exemple #2
0
        private static void SendFailedSyncFilesMsg(string receiver, List <string> filesNameslist)
        {
            if (filesNameslist.Count.Equals(0))
            {
                return;
            }
            ServerWebSocket serverSocket = ServerWebSocket.Instance;

            serverSocket.SendToOne(receiver, filesNameslist);
        }
Exemple #3
0
        private static void SendUpdateFileListToAll()
        {
            ServerWebSocket serverSocket = ServerWebSocket.Instance;

            serverSocket.SendToAll(new Message()
            {
                Key   = MsgType.REFRESH_FILES_LIST_MSG,
                Value = "Update"
            });
        }
        private void BtnSave_Click(object sender, EventArgs e)
        {
            var oldSett = AppSettings.GetSetting();


            var newSetting = new Setting
            {
                WebSocketPort = Convert.ToInt32(tbPort.Text),
                Accounts      = new List <string>()
            };

            if (!string.IsNullOrEmpty(tbAccount1.Text))
            {
                newSetting.Accounts.Add(tbAccount1.Text);
            }
            if (!string.IsNullOrEmpty(tbAccount2.Text))
            {
                newSetting.Accounts.Add(tbAccount2.Text);
            }
            if (!string.IsNullOrEmpty(tbAccount3.Text))
            {
                newSetting.Accounts.Add(tbAccount3.Text);
            }
            if (!string.IsNullOrEmpty(tbAccount4.Text))
            {
                newSetting.Accounts.Add(tbAccount4.Text);
            }
            if (!string.IsNullOrEmpty(tbAccount5.Text))
            {
                newSetting.Accounts.Add(tbAccount5.Text);
            }

            lblError.Text = AppSettings.ValidateSetting(newSetting);

            InstaApi.SetApiInstances(newSetting.Accounts);

            if (string.IsNullOrEmpty(lblError.Text))
            {
                AppSettings.SetSetting(newSetting);
                if (oldSett.WebSocketPort != newSetting.WebSocketPort)
                {
                    ServerWebSocket.ChangePort(newSetting.WebSocketPort);
                }

                Close();
            }
        }
Exemple #5
0
 public ExternalAdapterController()
 {
     Project_path = AppDomain.CurrentDomain.BaseDirectory;
     ServerSocket = ServerWebSocket.Instance;
 }