private void Logout() { if (!_logined) return; _logined = false; if (_serverStatusMaster) if (_clientService != null && _clientService.ServiceProxy != null) _clientService.ServiceProxy.Logout("d", _client.UserName); if (_logonThread != null) _logonThread.Abort(); ClientDatabaseManager.CloseConnectionToDbSystem(); Invoke((Action) delegate { metroTabItem2.Visible = false; metroTabItem3.Visible = false; metroShell1.SelectedTab = metroTabItem1; ClientDatabaseManager.CloseConnectionToDbSystem(); RefreshGroups(); RefreshSymbols(); _client = null; _startControl.Dispose(); _startControl = new StartControl {Commands = _commands}; Controls.Add(_startControl); _startControl.BringToFront(); _startControl.SlideSide = DevComponents.DotNetBar.Controls.eSlideSide.Right; UpdateControlsSizeAndLocation(); _startControl.ui_textBox_ip.Text = Settings.Default.scHost; _pingTimer.Enabled = true; }); }
public FormMainDN() { SuspendLayout(); InitializeComponent(); _commands = new MetroBillCommands { StartControlCommands = {Logon = new Command(), Exit = new Command()}, NewSymbolCommands = {NewGroup = new Command(), Cancel = new Command(), EditGroup = new Command()}, NewListCommands = {Add = new Command(), Cancel = new Command()}, EditListCommands = {Save = new Command(), Cancel = new Command()} }; _commands.StartControlCommands.Logon.Executed += StartControl_LogonClick; _commands.StartControlCommands.Exit.Executed += StartControl_ExitClick; _commands.NewSymbolCommands.Cancel.Executed += CancelNewSymbolExecuted; _commands.NewSymbolCommands.NewGroup.Executed += NewGroupNewSymbolExecuted; _commands.NewSymbolCommands.EditGroup.Executed += EditGroupNewSymbolExecuted; _commands.NewListCommands.Add.Executed += AddListControl_SaveClick; _commands.NewListCommands.Cancel.Executed += AddListControl_CancelClick; _commands.EditListCommands.Save.Executed += EditListControl_SaveClick; _commands.EditListCommands.Cancel.Executed += CancelEditListExecuted; //styledListControl1.ItemEditGroupClick += styledListControl1_ItemEditGroupClick; //groupList4.ItemEditGroupClick+=groupList4_ItemEditGroupClick; labelItemUserName.Text = @"ver " + Application.ProductVersion; _startControl = new StartControl {Commands = _commands}; //_addUserControl = new AddUserControl {Commands = _commands, Tag = 0}; Controls.Add(_startControl); _startControl.BringToFront(); _startControl.SlideSide = DevComponents.DotNetBar.Controls.eSlideSide.Right; ResumeLayout(false); _busySymbolList = new DNetBusySymbolList(); Daily_NotChanchedValuesManager.Init(); }