Exemplo n.º 1
0
        public MacPlatformService()
        {
            if (IntPtr.Size == 8)
            {
                throw new Exception("Mac integration is not yet 64-bit safe");
            }

            if (initedGlobal)
            {
                throw new Exception("Only one MacPlatformService instance allowed");
            }
            initedGlobal = true;

            timer.BeginTiming();

            systemVersion = Carbon.Gestalt("sysv");

            mimemap = new Lazy <Dictionary <string, string> > (LoadMimeMapAsync);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName(BrandingService.ApplicationName);

            CheckGtkVersion(2, 24, 14);

            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarWindowBackend, ExtendedTitleBarWindowBackend> ();
            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarDialogBackend, ExtendedTitleBarDialogBackend> ();
        }
Exemplo n.º 2
0
        public MacPlatformService()
        {
            if (initedGlobal)
            {
                throw new Exception("Only one MacPlatformService instance allowed");
            }
            initedGlobal = true;

            timer.BeginTiming();

            var dir = Path.GetDirectoryName(typeof(MacPlatformService).Assembly.Location);

            if (ObjCRuntime.Dlfcn.dlopen(Path.Combine(dir, "libxammac.dylib"), 0) == IntPtr.Zero)
            {
                LoggingService.LogFatalError("Unable to load libxammac");
            }

            mimemap = new Lazy <Dictionary <string, string> > (LoadMimeMapAsync);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName(BrandingService.ApplicationName);

            CheckGtkVersion(2, 24, 14);

            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarWindowBackend, ExtendedTitleBarWindowBackend> ();
            Xwt.Toolkit.CurrentEngine.RegisterBackend <IExtendedTitleBarDialogBackend, ExtendedTitleBarDialogBackend> ();
        }
Exemplo n.º 3
0
        public MacPlatformService()
        {
            if (initedGlobal)
            {
                throw new Exception("Only one MacPlatformService instance allowed");
            }
            initedGlobal = true;

            timer.BeginTiming();

            systemVersion = Carbon.Gestalt("sysv");

            mimemap = new Lazy <Dictionary <string, string> > (LoadMimeMapAsync);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName(BrandingService.ApplicationName);

            Cocoa.InitMonoMac();

            CheckGtkVersion(2, 24, 14);

            timer.Trace("Installing App Event Handlers");
            GlobalSetup();

            timer.EndTiming();
        }
Exemplo n.º 4
0
        public void TestProcessName()
        {
            string processName = "HelloWorld";

            Carbon.SetProcessName(processName);

            Process currentProcess = Process.GetCurrentProcess();

            Assert.AreEqual(processName, currentProcess.ProcessName);
        }
Exemplo n.º 5
0
        static MacPlatform()
        {
            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName("MonoDevelop");

            GlobalSetup();
            mimemap = new Dictionary <string, string> ();
            LoadMimeMap();

            CheckGtkVersion(2, 17, 9);
        }
Exemplo n.º 6
0
        static void OnApplicationMenuNameChanged()
        {
            Command aboutCommand = IdeApp.CommandService.GetCommand(HelpCommands.About);

            if (aboutCommand != null)
            {
                aboutCommand.Text = GetAboutCommandText();
            }

            Command hideCommand = IdeApp.CommandService.GetCommand(MacIntegrationCommands.HideWindow);

            if (hideCommand != null)
            {
                hideCommand.Text = GetHideWindowCommandText();
            }

            Carbon.SetProcessName(ApplicationMenuName);
        }
Exemplo n.º 7
0
        static MacPlatform()
        {
            timer.BeginTiming();

            LoadMimeMapAsync();

            CheckGtkVersion(2, 17, 9);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName("MonoDevelop");

            timer.Trace("Initializing NSApplication");
            MonoMac.AppKit.NSApplication.Init();

            timer.Trace("Installing App Event Handlers");
            GlobalSetup();

            timer.EndTiming();
        }
Exemplo n.º 8
0
        static MacPlatformService()
        {
            timer.BeginTiming();

            systemVersion = Carbon.Gestalt("sysv");

            LoadMimeMapAsync();

            CheckGtkVersion(2, 24, 0);

            //make sure the menu app name is correct even when running Mono 2.6 preview, or not running from the .app
            Carbon.SetProcessName(BrandingService.ApplicationName);

            MonoDevelop.MacInterop.Cocoa.InitMonoMac();

            timer.Trace("Installing App Event Handlers");
            GlobalSetup();

            timer.EndTiming();
        }
Exemplo n.º 9
0
        public static void Main(string[] args)
        {
            Application.Init();
            if (args.Length == 0)
            {
                ShowHelp();
                return;
            }
            if (args [0] == "-c")
            {
                if (args.Length != 2)
                {
                    ShowHelp();
                    return;
                }
                service = InstrumentationService.GetRemoteService(args[1]);
                try
                {
                    service.GetCategories();
                }
                catch (Exception ex)
                {
                    MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, "Could not connect to instrumentation service: " + ex.Message);
                    md.Run();
                    md.Destroy();
                    return;
                }
            }
            else if (args.Length == 1)
            {
                LoadServiceData(args[0]);
            }
            else
            {
                ShowHelp();
                return;
            }

            InstrumentationViewerDialog win = new InstrumentationViewerDialog();

            win.Show();

            if (MacIntegration.PlatformDetection.IsMac)
            {
                try
                {
                    Carbon.SetProcessName("MDMonitor");

                    ApplicationEvents.Quit += delegate(object sender, ApplicationQuitEventArgs e)
                    {
                        Application.Quit();
                        e.Handled = true;
                    };

                    ApplicationEvents.Reopen += delegate(object sender, ApplicationEventArgs e)
                    {
                        if (win != null)
                        {
                            win.Deiconify();
                            win.Visible = true;
                            e.Handled   = true;
                        }
                    };
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Installing Mac AppleEvent handlers failed. Skipping.\n" + ex);
                }
                try
                {
                    win.InstallMacGlobalMenu();
                }
                catch (Exception ex)
                {
                    Console.Error.WriteLine("Installing Mac IGE Main Menu failed. Skipping.\n" + ex);
                }
            }

            Application.Run();
        }