Esempio n. 1
0
 public static void OpenHyperlinkHandler(string url)
 {
     try
     {
         BrowserUtil.OpenSupportSite(url);
     }
     catch
     {
     }
 }
Esempio n. 2
0
 public static void OpenGalleryHandler(string str)
 {
     try
     {
         ISessionService sessionService = ServiceUtil.Instance.SessionService;
         IDataService    dataService    = ServiceUtil.Instance.DataService;
         if (sessionService.TicketAvailable)
         {
             string param = "ck=" + sessionService.Ticket + "&rd=" + System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(str));
             string url   = dataService.ServerInfo.TuKu + System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(param));
             BrowserUtil.OpenSupportSite(url);
         }
         else
         {
             System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(BrowserUtil.GetTicketTuKuBrowser), str);
         }
     }
     catch
     {
     }
 }
Esempio n. 3
0
 private static void GetTicketBrowser(object obj)
 {
     try
     {
         IWSClient       wsClient       = ServiceUtil.Instance.WsClient;
         IDataService    dataService    = ServiceUtil.Instance.DataService;
         ISessionService sessionService = ServiceUtil.Instance.SessionService;
         System.Threading.Monitor.Enter(BrowserUtil.logger);
         for (int i = 0; i < 1; i++)
         {
             wsClient.Url = dataService.ServerInfo.WebSsoOGet;
             wsClient.AddParams("username", sessionService.UserName);
             wsClient.AddParams("password", sessionService.Password);
             wsClient.AddParams("ticket", sessionService.Ticket);
             sessionService.Ticket = wsClient.GetTicket();
             if (!string.IsNullOrEmpty(sessionService.Ticket))
             {
                 break;
             }
         }
         if (sessionService.TicketAvailable && obj != null)
         {
             string param = "ck=" + sessionService.Ticket + "&rd=" + System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(obj.ToString()));
             string url   = dataService.ServerInfo.WebSsoRequest + System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(param));
             BrowserUtil.OpenSupportSite(url);
         }
         else
         {
             MessageBox.Show("无法取到Ticket!");
         }
         System.Threading.Monitor.Exit(BrowserUtil.logger);
     }
     catch (System.Exception e)
     {
         BrowserUtil.logger.Error(e.ToString());
     }
 }
Esempio n. 4
0
        private static bool OpenSupportSite(string url)
        {
            string browser = BrowserUtil.GetSystemDefaultBrowser();
            bool   result;

            if (!browser.Contains("温馨提示"))
            {
                try
                {
                    new Process
                    {
                        StartInfo =
                        {
                            FileName  = browser,
                            Arguments = url
                        }
                    }.Start();
                }
                catch (Win32Exception e)
                {
                    if (e.NativeErrorCode == 2)
                    {
                        Process.Start("iexplore", url);
                    }
                    result = false;
                    return(result);
                }
                result = true;
            }
            else
            {
                MessageBox.Show(string.Format("{0}", browser), "提示", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                result = false;
            }
            return(result);
        }