示例#1
0
        private static int Main(string[] args)
        {
            if (args.Length > 0)
            {
                string action = string.Empty;
                try
                {
                    if (args[0] == "/register")
                    {
                        action = "register";
                        SqrlProtocolRegistrar.Register();
                        return(Success);
                    }

                    if (args[0] == "/unregister")
                    {
                        action = "unregister";
                        SqrlProtocolRegistrar.Unregister();
                        return(Success);
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    return(Unauthorized);
                }
                catch (ArgumentException)
                {
                    return(NotRegistered);
                }
                catch
                {
                    return(GeneralError);
                }
            }

            Identity.StorageProvider = new AppSettingsIdentityStorageProvider();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var sqrlDesktopClient = new SqrlDesktopClient();

            sqrlDesktopClient.Urls.AddRange(args);

            Application.Run(sqrlDesktopClient);
            return(0);
        }
示例#2
0
        private static int Main(string[] args)
        {
            if (args.Length > 0)
            {
                string action = string.Empty;
                try
                {
                    if (args[0] == "/register")
                    {
                        action = "register";
                        SqrlProtocolRegistrar.Register();
                        return Success;
                    }

                    if (args[0] == "/unregister")
                    {
                        action = "unregister";
                        SqrlProtocolRegistrar.Unregister();
                        return Success;
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    return Unauthorized;
                }
                catch (ArgumentException)
                {
                    return NotRegistered;
                }
                catch
                {
                    return GeneralError;
                }
            }

            Identity.StorageProvider = new AppSettingsIdentityStorageProvider();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var sqrlDesktopClient = new SqrlDesktopClient();
            sqrlDesktopClient.Urls.AddRange(args);

            Application.Run(sqrlDesktopClient);
            return 0;
        }