Esempio n. 1
0
        public static bool OpenInDefaultApplication(string path, string arg = null)
        {
            bool bSuccess = false;

            try
            {
                if (File.Exists(path) && !IsUnsafeFileType(path))
                {
                    CommonTools.Log("[Opening " + @path + "].");
                    System.Diagnostics.Process.Start(path, arg);
                    bSuccess = true;
                    CommonTools.Log("[" + path + "] opened.");
                }
                else
                {
                    CommonTools.Log("[" + path + "] not found.");
                }
            }
            catch (Exception ex)
            {
                CommonTools.HandleException(ex);
            }

            return(bSuccess);
        }
Esempio n. 2
0
        public static bool OpenURL(string url)
        {
            bool bSuccess = false;

            try
            {
                if (false == String.IsNullOrEmpty(url))
                {
                    CommonTools.Log("[Opening URL =>" + @url + "].");
                    System.Diagnostics.Process.Start(url);
                    bSuccess = true;
                }
            }
            catch (Exception ex)
            {
                CommonTools.HandleException(ex);
            }
            return(bSuccess);
        }