Exemplo n.º 1
0
        //public void WorkThreadFunction(object name)
        //{
        //    try
        //    {
        //        AddInToken token = _selectedItem;

        //        _addin = token.Activate<HostView.WPFAddInHostView>(AddInSecurityLevel.FullTrust);
        //        ResourceUtil.Tabview.Add((String)name, _addin);
        //        Dispatcher.BeginInvoke((Action)delegate
        //        {
        //            UserControl con = (_addin as UserControl);
        //            userControlview.Content = con;
        //            userControlview.IsEnabled = !userControlview.IsEnabled;
        //        },
        //    DispatcherPriority.Normal);
        //    }
        //    catch (Exception ex)
        //    {

        //    }
        //}

        private void LogoutBlock_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (!_loadready)
                return;
            ResourceUtil.Tabview.Clear();
            Account.Username = String.Empty;
            liveviewtab.Foreground = new SolidColorBrush(Colors.White);
            liveviewtab.Visibility = Visibility.Hidden;
            LivevieLine.Visibility = Visibility.Hidden;
            //_tokens.Clear();
            //LbxMenu.ItemsSource = null;
            if (_addin != null)
            {
                if(!_addin.EndMess(true))
                    return;
                //Unload the addIn
                ShutdownPlugin();
                //end
                _addin = null;
                LbxMenu.ItemsSource = null;
                _loadready = false;
            }
            //userControlview.Content = new UserControl();
            _liveView.DisposeAllScreen();
            ((ContentControl)_liveView.Parent).RemoveChild(_liveView);
            _liveView = null;
            userControlview.Content = null;
            _infoClient.Disconnect();
            //GC.Collect();
            //GC.WaitForPendingFinalizers();
            
            Login();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Call Login form when app start
 /// </summary>
 public void Login()
 {
     _login = new Login();
     _login.Owner = this;
     var res = _login.ShowDialog();
     //if(res == null)
     //    _login.Show();
     if (Account.Username == string.Empty)
     {
         try
         {
             GC.Collect();
             GC.WaitForPendingFinalizers();
             Close();
         }
         catch (Exception ex)
         {
             
         }
     }
     //_backgroundWorker = new BackgroundWorker();
     //_backgroundWorker.DoWork += BackgroundWorker_DoWork;
     //_backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;
     //_backgroundWorker.ProgressChanged += BackgroundWorker_ProgressChanged;
     //_backgroundWorker.WorkerReportsProgress = true;
     //BusyIndicatorHandler busy = new BusyIndicatorHandler();
     _busy.Start();
     LoadPlugin();
     if (_liveView == null)
         _liveView = new LiveViewUsercontrol();
     _busy.Stop();
     _loadready = true;
     liveviewtab.Visibility = Visibility.Visible;
     LivevieLine.Visibility = Visibility.Visible;
     liveviewtab.Foreground = new SolidColorBrush(Colors.Goldenrod);
     //userControlview.Content = _liveView;
     userControlview.Content = _liveView;
     //Content.UpdateLayout();
     CreateInfoClient();
 }