Exemplo n.º 1
0
 public async void Connect(MetroWindow window, ProgressRing ring)
 {
     await Task.Run(() => {
         const string url = @"http://194.87.232.14:999";
         //const string url = @"http://localhost:8080";
         _connection = new HubConnection(url);
         _hub        = _connection.CreateHubProxy("TransaqHub");
         try
         {
             _connection.Start().Wait();
             Application.Current.Dispatcher.Invoke(() =>
             {
                 window.HideOverlay();
                 ring.IsActive = false;
             });
             _hub.On("ServerReply", msg => CheckServerReply(msg));
         }
         catch (Exception e)
         {
             Application.Current.Dispatcher.Invoke(async() =>
             {
                 ring.IsActive = false;
                 await window.ShowMessageAsync("Error", "Server is unavailable.");
                 Application.Current.Shutdown();
             });
         }
     });
 }
Exemplo n.º 2
0
        /// <summary>
        /// 隐藏遮罩
        /// </summary>
        public static void HideOverlay()
        {
            MetroWindow currentView = Application.Current.MainWindow as MetroWindow;

            if (currentView == null && _Current != null)
            {
                ViewAware viewAware = (ViewAware)_Current;
                currentView = (MetroWindow)viewAware.GetView();
            }
            else if (currentView == null)
            {
                return;
            }
            else
            {
                return;
            }

            currentView.HideOverlay();
        }
Exemplo n.º 3
0
 private static Task HandleOverlayOnHide(MetroDialogSettings settings, MetroWindow window)
 {
     return (settings == null || settings.UseAnimations ? window.HideOverlayAsync() : Task.Factory.StartNew(() => window.Dispatcher.Invoke(new Action(() => window.HideOverlay()))));
 }
Exemplo n.º 4
0
 private static Task HandleOverlayOnHide(MetroDialogSettings settings, MetroWindow window)
 {
     return(settings == null || settings.AnimateHide ? window.HideOverlayAsync() : Task.Factory.StartNew(() => window.Dispatcher.Invoke(new Action(() => window.HideOverlay()))));
 }