Show() public static method

Displays a dialog allowing the user to sign a set of Feeds.
public static Show ( [ files ) : void
files [ The files to be signed.
return void
Esempio n. 1
0
        [STAThread] // Required for WinForms
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ErrorReportForm.SetupMonitoring(new Uri("https://0install.de/error-report/"));
            NetUtils.ApplyProxy();

            var openPgp = OpenPgpFactory.CreateDefault();

            if (args == null || args.Length == 0)
            {
                Application.Run(new WelcomeForm(openPgp));
            }
            else
            {
                try
                {
                    var files = ArgumentUtils.GetFiles(args, "*.xml");
                    if (files.Count == 1)
                    {
                        string path = files.First().FullName;
                        Application.Run(new MainForm(FeedEditing.Load(path), openPgp));
                    }
                    else
                    {
                        MassSignForm.Show(files);
                    }
                }
                #region Error handling
                catch (ArgumentException ex)
                {
                    Msg.Inform(null, ex.Message, MsgSeverity.Warn);
                }
                catch (IOException ex)
                {
                    Msg.Inform(null, ex.Message, MsgSeverity.Warn);
                }
                catch (UnauthorizedAccessException ex)
                {
                    Msg.Inform(null, ex.Message, MsgSeverity.Warn);
                }
                catch (InvalidDataException ex)
                {
                    Msg.Inform(null, ex.Message + (ex.InnerException == null ? "" : Environment.NewLine + ex.InnerException.Message), MsgSeverity.Warn);
                }
                #endregion
            }
        }
Esempio n. 2
0
        [STAThread] // Required for WinForms
        private static void Main(string[] args)
        {
            ProcessUtils.SanitizeEnvironmentVariables();
            NetUtils.ApplyProxy();

            WindowsUtils.SetCurrentProcessAppID("ZeroInstall.Publishing");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ErrorReportForm.SetupMonitoring(new Uri("https://0install.de/error-report/"));

            var openPgp = OpenPgp.Signing();

            if (args.Length == 0)
            {
                Application.Run(new WelcomeForm(openPgp));
            }
            else
            {
                try
                {
                    var files = Paths.ResolveFiles(args, "*.xml");
                    if (files.Count == 1)
                    {
                        string path = files.First().FullName;
                        Application.Run(new MainForm(FeedEditing.Load(path), openPgp));
                    }
                    else
                    {
                        MassSignForm.Show(files);
                    }
                }
                #region Error handling
                catch (Exception ex) when(ex is ArgumentException or IOException or InvalidDataException)
                {
                    Msg.Inform(null, ex.GetMessageWithInner(), MsgSeverity.Warn);
                }
                catch (Exception ex) when(ex is UnauthorizedAccessException)
                {
                    Msg.Inform(null, ex.Message, MsgSeverity.Error);
                }
                #endregion
            }
        }