Example #1
0
        private void Logout(bool enableTime = true)
        {
            if (!_logined) return;

            _logined = false;

            StopCollecting();

            if (_serverStatus)
                if (_clientService != null)
                {
                    _clientService.ServiceProxy.Logout("t", _client.UserName);
                }
            if (_dnormClientService != null && _client.ConnectedToSharedDb && _normalizerStatus)
                _dnormClientService.ServiceProxy.Logout();

            if (_logonThread != null) _logonThread.Abort();

            Invoke((Action)delegate
            {
                metroTabItem2.Visible = false;
                metroShell1.SelectedTab = metroTabItem1;
                TickNetClientDataManager.CloseConnectionToDbLive();
                TickNetClientDataManager.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.connectionHost;
                if (enableTime) _pingTimer.Enabled = true;
            });
        }
Example #2
0
        public FormMain()
        {
            SuspendLayout();

            InitializeComponent();

            _commands = new MetroBillCommands
            {
                StartControlCommands = { Logon = new Command(), Exit = new Command() },
                NewSymbolCommands = { NewGroup = new Command(), EditGroup = new Command(), Cancel = 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;

            labelItemUserName.Text = @"ver " + Application.ProductVersion;

            _startControl = new StartControl { Commands = _commands };
            Controls.Add(_startControl);
            _startControl.BringToFront();
            _startControl.SlideSide = DevComponents.DotNetBar.Controls.eSlideSide.Right;
            ResumeLayout(false);
            _busySymbolList = new List<int>();
        }