Example #1
0
        public override void FinishedLaunching(NSObject notification)
        {
            ///////
            /// Glorified Event "Handler"
            ///  for Menu Items (like File, edit and so forth)
            ///////
            ///

            // *************************** //
            // TODO
            // - Reimplement SaveAs (command-S)

            mainWindowController = new MainWindowController ();
            mainWindowController.Window.MakeKeyAndOrderFront (this);

            MainWindow winMain = mainWindowController.Window;

            /////
            /// SaveAs File Menu Item
            /////
            miSaveAs.Activated += (object sender, EventArgs e) => {
                SharedWindowMethods.SaveCurrentSetFilePanel ();
            };

            /////
            /// Open File Menu Item
            /////
            miOpen.Activated += (object sender, EventArgs e) => {
                // Call for openPanel
                // Credit user: rjm
                // http://forums.xamarin.com/discussion/3876/regression-in-nsopenpanel
                NSOpenPanel openPanel = new NSOpenPanel ();
                openPanel.Begin (((int result) => {
                    try {
                        if (openPanel.Url != null) {
                            // get path
                            var file = openPanel.Url.Path;

                            // open file
                            m_at.OpenFile (System.IO.Path.GetFileName (file), System.IO.Path.GetDirectoryName (file));

                            // parse open file
                            m_at.InitSet ();

                            // init SetRunner
                            m_sr.Init (m_at.GetSetList ());

                            // update table
                            winMain.tbvSetList.DataSource = new TableViewHandler (m_at.GetSetListTable ());

                        }
                    } finally {
                        openPanel.Dispose ();
                    }
                }));

                // refresh window gui
                winMain.updateGUI ();
            };
        }
Example #2
0
        public override void FinishedLaunching(NSObject notification)
        {
            ///////
            /// Glorified Event "Handler"
            ///  for Menu Items (like File, edit and so forth)
            ///////
            ///

            // *************************** //
            // TODO
            // - Reimplement SaveAs (command-S)


            mainWindowController = new MainWindowController();
            mainWindowController.Window.MakeKeyAndOrderFront(this);

            MainWindow winMain = mainWindowController.Window;

            /////
            /// SaveAs File Menu Item
            /////
            miSaveAs.Activated += (object sender, EventArgs e) => {
                SharedWindowMethods.SaveCurrentSetFilePanel();
            };

            /////
            /// Open File Menu Item
            /////
            miOpen.Activated += (object sender, EventArgs e) => {
                // Call for openPanel
                // Credit user: rjm
                // http://forums.xamarin.com/discussion/3876/regression-in-nsopenpanel
                NSOpenPanel openPanel = new NSOpenPanel();
                openPanel.Begin(((int result) => {
                    try {
                        if (openPanel.Url != null)
                        {
                            // get path
                            var file = openPanel.Url.Path;

                            // open file
                            m_at.OpenFile(System.IO.Path.GetFileName(file), System.IO.Path.GetDirectoryName(file));

                            // parse open file
                            m_at.InitSet();

                            // init SetRunner
                            m_sr.Init(m_at.GetSetList());

                            // update table
                            winMain.tbvSetList.DataSource = new TableViewHandler(m_at.GetSetListTable());
                        }
                    } finally {
                        openPanel.Dispose();
                    }
                }));

                // refresh window gui
                winMain.updateGUI();
            };
        }