Пример #1
0
partial         void Button(MonoMac.Foundation.NSObject sender)
        {
            RunTests ();

            var number = power.Compute (++current);
            Label.StringValue = string.Format ("{0} is the power!", number);
        }
Пример #2
0
        public override NSCell GetCell(NSOutlineView view, NSTableColumn column, MonoMac.Foundation.NSObject item)
        {
            NSCmisTree cmis = item as NSCmisTree;
            if (cmis == null) {
                Console.WriteLine ("GetCell Error");
                return null;
            }
            if (column == null) {
                return null;
            } else if (column.Identifier.Equals ("Name")) {
//                Console.WriteLine ("GetCell " + cmis);
                NSButtonCell cell = new NSButtonCell ();
                if (cmis.Parent != null)
                    cell.SetButtonType (NSButtonType.Switch);
                else
                    cell.SetButtonType (NSButtonType.Radio);
                // FIXME cell.AllowsMixedState = true;
                cell.Title = cmis.Name;
                cell.Editable = true;
                return cell;
            } else {
                NSTextFieldCell cell = new NSTextFieldCell ();
                return cell;
            }
        }
Пример #3
0
        public void NewDocument(MonoMac.Foundation.NSObject sender)
        {
            mainWindowController.Window.MakeKeyAndOrderFront(this);
            // call mainWindowController and tell him to do something new

            mainWindowController.NewDocument();
        }
Пример #4
0
partial         void exportFile(MonoMac.AppKit.NSButton sender)
        {
            var scfExport = new ExportSCF(txt_input.StringValue, txt_output.StringValue);
            NSTextView txt = (NSTextView) txt_fld_output.DocumentView;
            //txt.TextStorage.Append(new NSAttributedString(parser.GetParseOutput()));
            txt.TextStorage.Append(new NSAttributedString(scfExport.DebugOutput));
        }
Пример #5
0
		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
		{
	
			game = new ParticleSampleGame();
			game.Run ();
	
		}
Пример #6
0
 public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
 {
     // Don't use 'using' to dispose of this
     // On Mac, the game is run on a background thread
     _game = new ShowcaseGame();
     _game.Run();
 }
Пример #7
0
partial         void checkNowClick(MonoMac.Foundation.NSObject sender)
        {
            //TODO breakout getting notifications and linking it all up into a function
            //TODO use settings for token

            Notifications.DoNotificationCheck();
        }
Пример #8
0
 public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
 {
     using (var game = PlatformManager.Game)
     {
         game.Run();
     }
 }
Пример #9
0
        public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
        {
            Directory.SetCurrentDirectory(NSBundle.MainBundle.ResourcePath);

            if (getMaxfiles() < 512) {
                runCommand("launchctl", "limit maxfiles 512 4096");

                string execPath = NSBundle.MainBundle.BundlePath;
                int processId = NSProcessInfo.ProcessInfo.ProcessIdentifier;
                NSTask.LaunchFromPath("relaunch", new string[]{execPath, processId.ToString()});

                Environment.Exit(0);
            }

            WebClient updateClient = new WebClient();
            updateClient.DownloadStringCompleted += UpdateCheckCompleted;
            updateClient.DownloadStringAsync(new Uri("http://dl.dropbox.com/u/76985/MacTerraria_update.txt"));

            patchTerraria(Path.Combine(NSBundle.MainBundle.ResourcePath, "exes", "Terraria.exe"),
                          Path.Combine(NSBundle.MainBundle.ResourcePath, "Terraria.exe"));

            string savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "My Games", "Terraria");
            Directory.CreateDirectory(savePath);

            Assembly assembly = Assembly.LoadFrom(Path.Combine(NSBundle.MainBundle.ResourcePath, "Terraria.exe"));
            Type mainType = assembly.GetType("Terraria.Main");
            object game = Activator.CreateInstance(mainType);

            mainType.InvokeMember("Run", BindingFlags.Default | BindingFlags.InvokeMethod, null, game, null);
        }
Пример #10
0
		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
		{
			using (RolePlayingGame game = new RolePlayingGame())
			{
				game.Run();
			}
		}
		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
		{
			if (mainFormFunc != null)
				main_form = mainFormFunc ();
			main_form.m_helper.MakeKeyAndOrderFront (this);
			main_form.m_helper.DidChangeScreen += delegate(object sender, EventArgs e) { main_form.m_helper.Display (); };
		}
Пример #12
0
        public static bool IsSelectorExcludedFromWebScript(MonoMac.ObjCRuntime.Selector aSelector)
        {
            if (aSelector.Name == "callFromJs")
                return false;

            return true; // Запрещаем вызов всех остальных методов
        }
Пример #13
0
		partial void NotifyMeAction (MonoMac.AppKit.NSButton sender)
		{
			// First we create our notification and customize as needed
			NSUserNotification not = new NSUserNotification();
			not.Title = "Hello World";
			not.InformativeText = "This is an informative text";
			not.DeliveryDate = DateTime.Now;
			not.SoundName = NSUserNotification.NSUserNotificationDefaultSoundName;

			// We get the Default notification Center
			NSUserNotificationCenter center = NSUserNotificationCenter.DefaultUserNotificationCenter;
			
			center.DidDeliverNotification += (s, e) => 
			{
				Console.WriteLine("Notification Delivered");
				DeliveredColorWell.Color = NSColor.Green;
			};
			
			center.DidActivateNotification += (s, e) => 
			{
				Console.WriteLine("Notification Touched");
				TouchedColorWell.Color = NSColor.Green;
			};

			// If we return true here, Notification will show up even if your app is TopMost.
			center.ShouldPresentNotification = (c, n) => { return true; };
			
			center.ScheduleNotification(not);

		}
Пример #14
0
        public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
        {
            CCApplication application = new CCApplication ();
            application.ApplicationDelegate = new GameAppDelegate ();

            application.StartGame ();
        }
Пример #15
0
 public override void DrawRect(MonoMac.Foundation.NSRect dirtyRect)
 {
     base.DrawRect (dirtyRect);
       var context = MonoMac.AppKit.NSGraphicsContext.CurrentContext.GraphicsPort;
       context.SetFillColor (new MonoMac.CoreGraphics.CGColor (1, 0, 0));
       context.FillRect (new System.Drawing.RectangleF (5, 5, 10, 10));
       //base.DrawRect (dirtyRect);
 }
	    public AudioGraphEventArgs(AudioUnitRenderActionFlags actionFlags,
				       MonoMac.AudioToolbox.AudioTimeStamp timeStamp,
				       int busNumber,
				       int numberFrames,
				       AudioBufferList data)
		    : base(actionFlags, timeStamp, busNumber, numberFrames, data)
	    {
	    }
Пример #17
0
		public override bool WindowShouldClose (MonoMac.Foundation.NSObject sender)
		{
			return true; // 2.8, in previous versions closing the main window will close the App
			/*
			m_main.Shutdown ();
			return false;
			*/
		}
		partial void powerStateChanged (MonoMac.AppKit.NSSegmentedControl sender)
		{
			NSError error;
			CurrentInterface.SetPower(powerState.SelectedSegment == 0, out error);

			if(error != null)
				Console.WriteLine("Error occurred while changing interface power state: {0}", error.LocalizedDescription);
		}
Пример #19
0
 public override bool DoCommandBySelector(NSControl control, NSTextView textView, MonoMac.ObjCRuntime.Selector commandSelector)
 {
     if (control != null && "insertNewline:".Equals(commandSelector.Name))
     {
         onEnterPressed(control);
         return true;
     }
     return false;
 }
Пример #20
0
 public _AudioConverterEventArgs(
     uint _NumberDataPackets,
     AudioBufferList _Data,
     MonoMac.AudioToolbox.AudioStreamPacketDescription[] _DataPacketDescription)
 {
     NumberDataPackets = _NumberDataPackets;
     Data = _Data;
     DataPacketDescription = _DataPacketDescription;
 }
partial         void DeleteClicked(MonoMac.AppKit.NSButton sender)
        {
            string username;

            if (!GetUsername(out username))
                return;

            KeychainAccess.ClearPassword(username);
            NSAlert.WithMessage("Success", "OK", null, null, "Record cleared").BeginSheet(Window);
        }
		public override void HandleEvent (MonoMac.WebKit.DomEvent evt) {
			if (DateTime.Now > timeoutvalue) {
				// set new timeout
				timeoutvalue = DateTime.Now.AddSeconds (_time_out_value);

				//event received from keypress
				if (NoteContentChanged != null)
					NoteContentChanged ();
			}
		}
Пример #23
0
		public override void FinishedLaunching (MonoMac.Foundation.NSObject notification)
		{
			AppDomain.CurrentDomain.AssemblyResolve += (object sender, ResolveEventArgs a) =>  {
				if (a.Name.StartsWith("MonoMac")) {
					return typeof(MonoMac.AppKit.AppKitFramework).Assembly;
				}
				return null;
			};
			Program.RunGame();
		}
		public override void DidFinishLaunching (MonoMac.Foundation.NSNotification notification)
		{
			wizard = new AppleDocWizardController ();
			NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
			wizard.Window.MakeMainWindow ();
			wizard.Window.MakeKeyWindow ();
			wizard.Window.MakeKeyAndOrderFront (this);
			wizard.Window.Center ();
			wizard.VerifyFreshnessAndLaunchDocProcess ();
			NSApplication.SharedApplication.RunModalForWindow (wizard.Window);
		}
Пример #25
0
 public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
 {
     // Handle a Xamarin.Mac Upgrade
     AppDomain.CurrentDomain.AssemblyResolve += (object sender, ResolveEventArgs a) => {
         if (a.Name.StartsWith ("MonoMac")) {
             return typeof(MonoMac.AppKit.AppKitFramework).Assembly;
         }
         return null;
     };
     game = new Game1 ();
     game.Run ();
 }
Пример #26
0
partial         void openSelectFileDialog(MonoMac.Foundation.NSObject sender)
        {
            NSOpenPanel panel = NSOpenPanel.OpenPanel;
            panel.AllowsMultipleSelection = false;
            panel.CanChooseDirectories = false;
            int result = panel.RunModal();

            if (result == 1)
            {
                txt_input.StringValue = panel.Url.Path;
            }
        }
Пример #27
0
        public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
        {
            /*
            using (game = new ChessGame())
            {
                game.Run ();
            }
            */

            game = new ChessGame();
            game.Run();
        }
Пример #28
0
        public AudioUnitEventArgs(AudioUnitRenderActionFlags actionFlags,
				  MonoMac.AudioToolbox.AudioTimeStamp timestamp,
				  int busNumber,
				  int frames,
				  AudioBufferList data)
        {
            ActionFlags = actionFlags;
            this.TimeStamp = timestamp;
            BusNumber = busNumber;
            NumberFrames = frames;
            Data = data;
        }
partial         void FetchClicked(MonoMac.AppKit.NSButton sender)
        {
            string username, password;

            if (!GetUsername(out username))
                return;

            var success = KeychainAccess.GetPassword(username, out password);

            if (success)
                SavePasswordLabel.StringValue = password;
            else
                SavePasswordLabel.StringValue = "No record present for specified username";
        }
Пример #30
0
 public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
 {
     Logger.Start();
     try
     {
         game = new Game1();
         game.Run(Microsoft.Xna.Framework.GameRunBehavior.Synchronous);
     }
     catch (Exception e)
     {
         Logger.Log(e);
     }
     Logger.Finish();
 }