コード例 #1
0
ファイル: AppDelegate.cs プロジェクト: daviddw/oss-public
        public override void FinishedLaunching(NSObject notification)
        {
            NSImage img = new NSImage(NSBundle.MainBundle.PathForImageResource("Icon106x106.png"));

            // create the helpers
            iHelper = new Helper(Environment.GetCommandLineArgs());
            iHelper.ProcessOptionsFileAndCommandLine();

            CrashLogDumperWindowController d = new CrashLogDumperWindowController(img, iHelper.Title, iHelper.Product, iHelper.Version);

            d.LoadWindow();
            iHelper.AddCrashLogDumper(d);

            iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Mac.ViewAutoUpdateStandard(img), new Linn.Toolkit.Mac.Invoker());
            iHelperAutoUpdate.Start();

            // create the xapp components
            iXapp      = new Framework <Session>(Path.Combine(OpenHome.Xen.Environment.AppPath, "PageHtml"));
            iWebServer = new WebServer(iXapp);
            iControl   = new PageControl(iHelper, iXapp, Path.Combine(OpenHome.Xen.Environment.AppPath, "PageHtml"), "PageDefinitions.xml");
            iControl.EventCloseApplicationRequested += CloseApplicationRequested;

            // create and show the main window
            iMainWindow = new MainWindowController();
            iMainWindow.Window.Title = iHelper.Product;
            iViewBrowser             = new ViewerBrowser(iMainWindow.WebView, iWebServer.ResourceUri);
            iMainWindow.Window.MakeKeyAndOrderFront(this);
        }
コード例 #2
0
ファイル: AppDelegate.cs プロジェクト: daviddw/oss-public
        public override void AwakeFromNib()
        {
            // initialise resigned state
            iSessionResigned = false;

            // load some images from the bundle
            NSImage largeIcon = new NSImage(NSBundle.MainBundle.PathForImageResource("IconLarge.png"));

            // create the app helper
            iHelper = new Helper(Environment.GetCommandLineArgs());
            iHelper.ProcessOptionsFileAndCommandLine();

            // add a crash log dumper
            CrashLogDumperWindowController d = new CrashLogDumperWindowController(largeIcon, iHelper.Title, iHelper.Product, iHelper.Version);

            d.LoadWindow();
            iHelper.AddCrashLogDumper(d);

            // create auto update view and helper
            iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Mac.ViewAutoUpdateStandard(largeIcon), new Invoker(), (s, e) => {});
            iHelperAutoUpdate.Start();

            // create the main songcast model
            iModel = new Model(new Invoker(), iHelper);
            iModel.EventEnabledChanged += ModelEnabledChanged;

            // create the preferences 'view' for communicating with the system preferences app
            iViewPreferences = new ViewPreferences(new Invoker(), iModel, iHelperAutoUpdate);

            // creating the status item with a length of -2 is equivalent to the call
            // [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength]
            iStatusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(-2);
            iStatusItem.HighlightMode = false;
            iStatusItem.Target        = this;
            iStatusItem.Action        = new Selector("statusItemClicked:");

            // setup system event notifications
            NSNotificationCenter center = NSWorkspace.SharedWorkspace.NotificationCenter;

            center.AddObserver(this, new Selector("willSleep:"), new NSString("NSWorkspaceWillSleepNotification"), null);
            center.AddObserver(this, new Selector("didWake:"), new NSString("NSWorkspaceDidWakeNotification"), null);
            center.AddObserver(this, new Selector("sessionDidResignActive:"), new NSString("NSWorkspaceSessionDidResignActiveNotification"), null);
            center.AddObserver(this, new Selector("sessionDidBecomeActive:"), new NSString("NSWorkspaceSessionDidBecomeActiveNotification"), null);

            // create the main window
            iMainWindow = new MainWindowController();
            iMainWindow.LoadWindow();
            iMainWindow.Window.DidResignKey      += MainWindowDidResignKey;
            iMainWindow.Window.CollectionBehavior = NSWindowCollectionBehavior.CanJoinAllSpaces;

            // create the xapp controller and view
            iXappController = new XappController(iModel, new Invoker());
            iXappController.MainPage.EventShowConfig += ShowConfig;
            iXappController.MainPage.EventShowHelp   += ShowHelp;
            iViewer = new ViewerBrowser(iMainWindow.WebView, iXappController.MainPageUri);
        }
コード例 #3
0
        public override void FinishedLaunching(NSObject notification)
        {
            // load images for the status item and windows
            NSImage sysTrayImage = new NSImage(NSBundle.MainBundle.PathForImageResource("SysTrayIcon.png"));
            NSImage largeImage   = new NSImage(NSBundle.MainBundle.PathForImageResource("Icon106x106.png"));

            // creating the status item with a length of -2 is equivalent to the call
            // [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength]
            iStatusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(-2);
            iStatusItem.HighlightMode = true;
            iStatusItem.Menu          = StatusMenu;
            iStatusItem.Image         = sysTrayImage;

            // create the app helper
            iHelper = new Helper(Environment.GetCommandLineArgs());
            OptionPagePrivacy optionPagePrivacy = new OptionPagePrivacy(iHelper);

            iHelper.AddOptionPage(optionPagePrivacy);
            iHelper.ProcessOptionsFileAndCommandLine();

            // create window for crash logging
            CrashLogDumperWindowController d = new CrashLogDumperWindowController(largeImage, iHelper.Title, iHelper.Product, iHelper.Version);

            d.LoadWindow();
            iHelper.AddCrashLogDumper(d);

            // create view and helper for the auto updates - hardcode check for beta versions for now
            IViewAutoUpdate autoUpdateView = new Linn.Toolkit.Mac.ViewAutoUpdateStandard(largeImage);

            iHelperAutoUpdate = new HelperAutoUpdate(iHelper, autoUpdateView, new Invoker());
            iHelperAutoUpdate.OptionPageUpdates.BetaVersions = iHelper.BuildType == EBuildType.Beta;
            iHelperAutoUpdate.Start();

            iPageMain = new Linn.Songbox.PageMain(iHelper, optionPagePrivacy, iHelperAutoUpdate, new StartAtLoginOption());

            IconInfo iconInfo = new IconInfo("logo.png", "image/png", 106, 106, 32);

            // create the media server
            iServer = new Server("git://github.com/linnoss/MediaApps.git", iHelper.Company, "http://www.linn.co.uk", iHelper.Title, "http://www.linn.co.uk", new Presentation(iPageMain), iconInfo);

            // create the main configuration window
            iWindow = new ConfigurationWindowController(iServer, iPageMain);
            iWindow.LoadWindow();
        }
コード例 #4
0
        public override void FinishedLaunching(NSObject notification)
        {
            // load some images from the bundle
            NSImage largeIcon = new NSImage(NSBundle.MainBundle.PathForImageResource("IconLarge.png"));

            // create the app helper
            iHelper = new Helper(Environment.GetCommandLineArgs());
            iHelper.ProcessOptionsFileAndCommandLine();

            // add a crash log dumper
            CrashLogDumperWindowController d = new CrashLogDumperWindowController(largeIcon, iHelper.Title, iHelper.Product, iHelper.Version);

            d.LoadWindow();
            iHelper.AddCrashLogDumper(d);

            // create auto update view and helper
            iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Mac.ViewAutoUpdateStandard(largeIcon), new Invoker());
            iHelperAutoUpdate.Start();

            iMainWindowController = new MainWindowController(iHelper.Product);
            MainWindowDelegate windowDelegate = new MainWindowDelegate(iMainWindowController.Window, iHelper.Title, largeIcon);

            iMainWindowController.Window.Delegate = windowDelegate;
            iMainWindowController.Window.MakeKeyAndOrderFront(this);

            Preferences preferences = new Preferences(iHelper);

            Model.Instance = new Model(preferences);

            // create the xapp controller and view
            Invoker invoker = new Invoker();
            SettingsPageAdvanced   settings  = new SettingsPageAdvanced(invoker, Model.Instance, preferences, iHelperAutoUpdate, "settings", "settings");
            UpdateListenerRepeater listeners = new UpdateListenerRepeater(new IUpdateListener[] { windowDelegate, settings });

            iXappController = new XappController(invoker, iHelper, Model.Instance, preferences, settings, listeners);
            iViewer         = new ViewerBrowser(iMainWindowController.WebView, iXappController.MainPageUri);
        }