private void fMain_Load(object sender, EventArgs e) { NetworkChange.NetworkAddressChanged += OnNetworkChange; //TODO: Should this stay? Program.Account.LoadLocalFolders(); if (!Log.DebugEnabled && Settings.General.EnableLogging) Log.DebugEnabled = true; Notifications.NotificationReady += (o, n) => { Link = Program.Account.LinkToRecent(); tray.ShowBalloonTip(100, n.Title, n.Text, ToolTipIcon.Info); }; Program.Account.Client.ConnectionClosed += (o, n) => Log.Write(l.Warning, "Connection closed: {0}", n.Text ?? string.Empty); Program.Account.Client.ReconnectingFailed += (o, n) => Log.Write(l.Warning, "Reconnecting failed"); //TODO: Use this... Program.Account.Client.ValidateCertificate += CheckCertificate; Program.Account.WebInterface.UpdateFound += (o, n) => { const string msg = "A new version of the web interface is available, do you want to upgrade to it?"; if ( MessageBox.Show(msg, "FTPbox - WebUI Update", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Program.Account.WebInterface.UpdatePending = true; Program.Account.WebInterface.Update(); } }; Program.Account.WebInterface.InterfaceRemoved += (o, n) => { Invoke(new MethodInvoker(() => { chkWebInt.Enabled = true; labViewInBrowser.Enabled = false; })); Link = string.Empty; }; Program.Account.WebInterface.InterfaceUploaded += (o, n) => { Invoke(new MethodInvoker(() => { chkWebInt.Enabled = true; labViewInBrowser.Enabled = true; })); Link = Program.Account.WebInterfaceLink; }; Notifications.TrayTextNotification += (o, n) => Invoke(new MethodInvoker(() => SetTray(o, n))); _fSetup = new Setup {Tag = this}; _ftranslate = new Translate {Tag = this}; _fSelective = new fSelectiveSync(); _fTrayForm = new fTrayForm {Tag = this}; if (!string.IsNullOrEmpty(Settings.General.Language)) Set_Language(Settings.General.Language); StartUpWork(); CheckForUpdate(); }
private async void fMain_Load(object sender, EventArgs e) { NetworkChange.NetworkAddressChanged += OnNetworkChange; //TODO: Should this stay? Program.Account.LoadLocalFolders(); if (!Log.DebugEnabled && Settings.General.EnableLogging) { Log.DebugEnabled = true; } Notifications.NotificationReady += (o, n) => { Link = Program.Account.LinkToRecent(); tray.ShowBalloonTip(100, n.Title, n.Text, ToolTipIcon.Info); }; Program.Account.WebInterface.UpdateFound += async(o, n) => { const string msg = "A new version of the web interface is available, do you want to upgrade to it?"; if ( MessageBox.Show(msg, "FTPbox - WebUI Update", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Program.Account.WebInterface.UpdatePending = true; await Program.Account.WebInterface.Update(); } }; Program.Account.WebInterface.InterfaceRemoved += (o, n) => { chkWebInt.Enabled = true; labViewInBrowser.Enabled = false; Link = string.Empty; }; Program.Account.WebInterface.InterfaceUploaded += (o, n) => { chkWebInt.Enabled = true; labViewInBrowser.Enabled = true; Link = Program.Account.WebInterfaceLink; }; Notifications.TrayTextNotification += (o, n) => SetTray(o, n); _fSetup = new Setup { Tag = this }; _ftranslate = new Translate { Tag = this }; _fSelective = new fSelectiveSync(); if (!string.IsNullOrEmpty(Settings.General.Language)) { Set_Language(Settings.General.Language); } await StartUpWork(); while (OfflineMode) { // wait 30 seconds before retrying to connect await Task.Delay(30000); // retry await StartUpWork(); } _fTrayForm = new fTrayForm { Tag = this }; CheckForUpdate(); // Check local folder for changes var cpath = Program.Account.GetCommonPath(Program.Account.Paths.Local, true); await Program.Account.SyncQueue.Add( new SyncQueueItem(Program.Account) { Item = new ClientItem(Common._name(cpath), Program.Account.Paths.Local, ClientItemType.Folder), ActionType = ChangeAction.changed, SyncTo = SyncTo.Remote }); await ContextMenuManager.RunServer(); }