Beispiel #1
0
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            base.OnFormClosed(e);
            s_openWindows.Remove(this);
#if C1DVIEW_APP
            if (s_openWindows.Count == 0)
            {
                C1dViewSettings.Save(this);
                Application.Exit();
            }
#endif
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            // method to make first form:
            Func <C1dViewForm> MakeFirstForm = () =>
            {
                var viewer = new C1dViewForm();
                C1dViewSettings.Load(viewer);
                viewer.Show();
                return(viewer);
            };

            // show all needed forms:
            if (args != null && args.Length > 0)
            {
                C1dViewForm viewer = null;
                for (int i = 0; i < args.Length; ++i)
                {
                    if (i == 0)
                    {
                        viewer = MakeFirstForm();
                        viewer.FileOpen(args[i]);
                    }
                    else
                    {
                        // open next file off last viewer to "cascade" windows:
                        viewer = viewer.FileNew(args[i]) ?? viewer;
                    }
                }
            }
            else
            {
                MakeFirstForm();
            }
            // no "main" form - the last one alive will be the main:
            Application.Run();
        }