Esempio n. 1
0
        public static int Main(string[] args)
        {
            try
            {
                var options = new CommandLineOptions(args);
                if (options.ShowHelp)
                {
                    options.Usage();
                    return(1);
                }

                // Load mutex
                AppMutex.EnsureLoaded();

                // Initialize target
                Locations.Target = Target;

                if (!string.IsNullOrEmpty(options.SamplesFolder))
                {
                    var toolForm = new SamplesToolForm(options.SamplesFolder);
                    Application.EnableVisualStyles();
                    Application.Run(toolForm);
                    return(0);
                }

                var form = new MainForm();
                Application.EnableVisualStyles();
                Application.Run(form);
                return(0);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex.Message);
#if DEBUG
                Console.WriteLine(ex.StackTrace);
#endif
                return(1);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Open the samples folder
        /// </summary>
        private void OnOpenSampleFolderExecuted(object sender, EventArgs e)
        {
            var folder = Locations.SamplesFolder(Targets.BlackBerry);

            if (!String.IsNullOrEmpty(folder))
            {
                try
                {
                    if (!Directory.Exists(folder))
                    {
                        using (var dialog = new SamplesToolForm(folder))
                        {
                            dialog.ShowDialog(this);
                        }
                    }
                    Process.Start(folder);
                }
                catch (Exception ex)
                {
                    var msg = String.Format(Resources.FailedToOpenSamplesFolderBecauseX, ex.Message);
                    MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }