Наследование: INativeObject, IDisposable
Пример #1
0
		public virtual void CloseSheet(NSObject sender, EventArgs e) {
			NSApplication.SharedApplication.EndSheet(Window);
			Window.Close();
			Window.Dispose();

			DidClose(this, e);
		}
Пример #2
0
		public MyOpenGLView (RectangleF frame,NSOpenGLContext context) : base(frame)
		{
			var attribs = new object[] { NSOpenGLPixelFormatAttribute.Accelerated, NSOpenGLPixelFormatAttribute.NoRecovery, NSOpenGLPixelFormatAttribute.DoubleBuffer, NSOpenGLPixelFormatAttribute.ColorSize, 24, NSOpenGLPixelFormatAttribute.DepthSize, 16 };

			pixelFormat = new NSOpenGLPixelFormat (attribs);

			if (pixelFormat == null)
				Console.WriteLine ("No OpenGL pixel format");

			// NSOpenGLView does not handle context sharing, so we draw to a custom NSView instead
			openGLContext = new NSOpenGLContext (pixelFormat, context);

			openGLContext.MakeCurrentContext ();

			// Synchronize buffer swaps with vertical refresh rate
			openGLContext.SwapInterval = true;

			// Initialize our newly created view.
			InitGL ();

			SetupDisplayLink ();

			// Look for changes in view size
			// Note, -reshape will not be called automatically on size changes because NSView does not export it to override 
			notificationProxy = NSNotificationCenter.DefaultCenter.AddObserver (NSView.NSViewGlobalFrameDidChangeNotification, HandleReshape);
		}
Пример #3
0
        public override void FinishedLaunching(NSObject notification)
        {
            mainWindowController = new MainWindowController ();
            mainWindowController.Window.MakeKeyAndOrderFront (this);

            NativeTest.Hello ();
        }
		partial void takeName (NSObject sender)
		{
			villain.Name = ((NSTextField)sender).StringValue;
			villainsTableView.ReloadData ();
			
			Console.WriteLine(string.Format("current villain properties: {0}", villain.Name));
		}
Пример #5
0
partial         void fileType(NSObject sender)
        {
            ChangeFileTypes(imageFilters[imageFilterSelector.IndexOfSelectedItem].Types);

            Preferences.Instance.ImageFilterIndex = imageFilterSelector.IndexOfSelectedItem;
            Preferences.Instance.Save();
        }
Пример #6
0
		public MonoMacGameView (RectangleF frame, NSOpenGLContext context) : base(frame)
		{
			var attribs = new object [] {
				NSOpenGLPixelFormatAttribute.Accelerated,
				NSOpenGLPixelFormatAttribute.NoRecovery,
				NSOpenGLPixelFormatAttribute.DoubleBuffer,
				NSOpenGLPixelFormatAttribute.ColorSize, 24,
				NSOpenGLPixelFormatAttribute.DepthSize, 16 };

			pixelFormat = new NSOpenGLPixelFormat (attribs);

			if (pixelFormat == null)
				Console.WriteLine ("No OpenGL pixel format");

			// NSOpenGLView does not handle context sharing, so we draw to a custom NSView instead
			openGLContext = new NSOpenGLContext (pixelFormat, context);

			openGLContext.MakeCurrentContext ();

			// default the swap interval and displaylink
			SwapInterval = true;
			DisplaylinkSupported = true;

			// Look for changes in view size
			// Note, -reshape will not be called automatically on size changes because NSView does not export it to override 
			notificationProxy = NSNotificationCenter.DefaultCenter.AddObserver (NSView.GlobalFrameChangedNotification, HandleReshape);
		}
Пример #7
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 ();
            };
        }
Пример #8
0
		public override void FinishedLaunching (NSObject notification)
		{
			CCApplication sharedApp = CCApplication.SharedApplication;
			sharedApp.ApplicationDelegate = new AppDelegate();

			CCApplication.SharedApplication.StartGame();
		}
			public override void SetObjectValue (NSTableView tableView, NSObject theObject, NSTableColumn tableColumn, int row)
			{
				NSString newNSValue = theObject as NSString;
				if (newNSValue == null)
					return;
				string newValue = newNSValue.ToString ();
				int columnIndex = tableView.FindColumn ((NSString)tableColumn.Identifier);
				BookmarkManager.Entry entry = entries[row];
				switch (columnIndex) {
				case 0:
					if (!string.IsNullOrWhiteSpace (newValue))
						entry.Name = newValue;
					break;
				case 1:
					entry.Notes = newValue;
					break;
				case 2:
					if (!string.IsNullOrWhiteSpace (newValue))
						entry.Url = newValue;
					break;
				default:
					break;
				}
				manager.CommitBookmarkChange (entry);
			}
Пример #10
0
        public override void FinishedLaunching(NSObject notification)
        {
            mainWindowController = new MainWindowController ();
            var window = mainWindowController.Window;
            window.MakeKeyAndOrderFront (this);

            titles = new NSObject[] {
                new NSString("Item 1"),
                new NSString("Item 2"),
                new NSString("Item 3"),
                new NSString("Item 4"),
                new NSString("Item 5"),
                new NSString("Item 6"),
                new NSString("Item 7"),
                new NSString("Item 8"),
            };

            cv = new NSCollectionView(window.ContentView.Frame);
            cvi = new MyCollectionViewItem();
            cv.ItemPrototype = cvi;
            cv.Content = titles;

            cv.AutoresizingMask = NSViewResizingMask.MinXMargin | NSViewResizingMask.WidthSizable | NSViewResizingMask.MaxXMargin | NSViewResizingMask.MinYMargin | NSViewResizingMask.HeightSizable | NSViewResizingMask.MaxYMargin;
            window.ContentView.AddSubview(cv);
        }
Пример #11
0
		public override void FinishedLaunching (NSObject notification)
		{
            CCApplication application = new CCApplication(false, new CCSize(1024f, 768f));
            application.ApplicationDelegate = new AppDelegate();

            application.StartGame();
        }
Пример #12
0
		public override void FinishedLaunching (NSObject notification)
		{
			mainWindowController = new MainWindowController ();
			mainWindowController.Window.MakeKeyAndOrderFront (this);
				
			string sc_dir = "/Users/toshok/src/scsharp/starcraft-data/starcraft";
			string bw_cd_dir = "/Users/toshok/src/scsharp/starcraft-data/bw-cd";
			string sc_cd_dir = "/Users/toshok/src/scsharp/starcraft-data/sc-cd";
			
            //string sc_cd_dir = ConfigurationManager.AppSettings["StarcraftCDDirectory"];
            //string bw_cd_dir = ConfigurationManager.AppSettings["BroodwarCDDirectory"];

			/* catch this pathological condition where someone has set the cd directories to the same location. */
            if (sc_cd_dir != null && bw_cd_dir != null && bw_cd_dir == sc_cd_dir) {
				Console.WriteLine ("The StarcraftCDDirectory and BroodwarCDDirectory configuration settings must have unique values.");
                return;
			}
			
			game = new Game (sc_dir /*ConfigurationManager.AppSettings["StarcraftDirectory"]*/,
				 			 sc_cd_dir, bw_cd_dir);
			
			mainWindowController.Window.ContentView = game;
			mainWindowController.Window.MakeFirstResponder (game);
			
			game.Startup();                                                                                                                                                       			
		}
Пример #13
0
 protected override void CheckToString(NSObject obj)
 {
     switch (obj.GetType ().FullName) {
     // native crash calling MonoMac.Foundation.NSObject.get_Description ()
     case "WebKit.WKNavigationAction":
     case "WebKit.WKFrameInfo": //  EXC_BAD_ACCESS (code=1, address=0x0)
     case "MonoMac.Foundation.NSUrlConnection":
     case "Foundation.NSUrlConnection":
     case "MonoMac.AppKit.NSLayoutConstraint": // Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil
     case "AppKit.NSLayoutConstraint":
     case "MonoMac.AVFoundation.AVPlayerItemTrack":
     case "AVFoundation.AVPlayerItemTrack":
     // 10.8
     case "MonoMac.AVFoundation.AVComposition":
     case "AVFoundation.AVComposition":
     case "MonoMac.GameKit.GKPlayer": // Crashing on 10.8.3 from the Apple beta channel for abock (on 2013-01-30)
     case "GameKit.GKPlayer":
     case "MonoMac.AVFoundation.AVAssetResourceLoadingRequest": // Crashing on 10.9.1 for abock (2014-01-13)
     case "AVFoundation.AVAssetResourceLoadingRequest":
     case "MonoMac.AVFoundation.AVAssetResourceLoadingDataRequest": // Crashes on 10.9.3 for chamons (constructor found in AVCompat)
     case "AVFoundation.AVAssetResourceLoadingDataRequest":
     case "MonoMac.AVFoundation.AVCaptureDeviceInputSource": // Crashes on 10.9.5
     case "AVFoundation.AVCaptureDeviceInputSource":
         break;
     default:
         base.CheckToString (obj);
         break;
     }
 }
Пример #14
0
		public override void FinishedLaunching (NSObject notification)
		{
			window = new NSWindow(new RectangleF (50, 50, 400, 400), (NSWindowStyle) (1 | (1 << 1) | (1 << 2) | (1 << 3)), NSBackingStore.Buffered, false);
			window.MakeKeyAndOrderFront(this);
			//mainWindowController = new MainWindowController ();
			//mainWindowController.Window.MakeKeyAndOrderFront (this);
		}
Пример #15
0
		public override void FinishedLaunching (NSObject notification)
		{
			mainWindowController = new MainWindowController ();
			mainWindowController.Window.MakeKeyAndOrderFront (this);

			NSApplication.SharedApplication.RegisterForRemoteNotificationTypes(NSRemoteNotificationType.Badge);
		}
Пример #16
0
		partial void addKey(NSObject sender)
		{
			if (KeyAdd != null)
			{
				KeyAdd(this, EventArgs.Empty);
			}
		}
partial         void SecondsStepperAction(NSObject sender)
        {
            NSStepper stepper = sender as NSStepper;

             //Console.WriteLine ("Change level: {0}", stepper.IntValue);
             SecondsTextField.IntValue = stepper.IntValue;
        }
Пример #18
0
		partial void openDocument(NSObject sender)
		{
			if (FileOpen != null)
			{
				FileOpen(this, EventArgs.Empty);
			}
		}
Пример #19
0
		partial void saveDocument(NSObject sender)
		{
			if (FileSave != null)
			{
				FileSave(this, EventArgs.Empty);
			}
		}
Пример #20
0
		partial void newDocument(NSObject sender)
		{
			if (FileNew != null)
			{
				FileNew(this, EventArgs.Empty);
			}
		}
Пример #21
0
		public override void MakeKeyAndOrderFront(NSObject sender)  {

			base.MakeKeyAndOrderFront (sender);
            /// Program entry point is here

            //TODO: Mac - really here??? Nooo
        }
Пример #22
0
        public override void FinishedLaunching(NSObject notification)
        {
            try
            {
                LSSharedFileList.InsertLoginItem(NSBundle.MainBundle.BundlePath);
            }
            catch
            {

            }

            var container = new Container();
            Tepeyac.Funq.Registry.Register(container);

            container.Register<IFiber>("GuiFiber", c =>
            {
                var executor =
                    c.Resolve<IExecutor>() ??
                    new Executor();
                var fiber = new CocoaFiber(executor);
                fiber.Start();

                return fiber;
            });

            container.Register<ILauncher>(c =>
                new Tepeyac.UI.Cocoa.Launcher());
            container.Register<IBurritoDayView>(c =>
                new StatusItemBurritoDayView(c));

            container.Resolve<IBurritoDayView>();
        }
		async partial void Create(NSObject sender) {
			Wallet wallet = await Wallet.CreateAsync(passphraseField.StringValue, WalletFile);
			await wallet.SaveAsync();

			DidCreate(this, new WalletCreationEventArgs(wallet));
			CloseSheet();
		}
Пример #24
0
		public override void FinishedLaunching (NSObject notification)
		{
			var indexManager = IndexUpdateManager;
			indexManager.CheckIndexIsFresh ().ContinueWith (t => {
				if (t.IsFaulted)
					Console.WriteLine ("Error while checking indexes: {0}", t.Exception);
				else if (!t.Result)
					indexManager.PerformSearchIndexCreation ();
				else
					indexManager.AdvertiseFreshIndex ();
			}).ContinueWith (t => Console.WriteLine ("Error while creating indexes: {0}", t.Exception), TaskContinuationOptions.OnlyOnFaulted);
			
			// Check if there is a MonoTouch documentation installed and launch accordingly
			if (Root.HelpSources.Cast<HelpSource> ().Any (hs => hs.Name.StartsWith ("MonoTouch", StringComparison.InvariantCultureIgnoreCase))
			    && File.Exists (mergeToolPath)) {
				Task.Factory.StartNew (() => {
					AppleDocHandler.AppleDocInformation infos;
					bool mergeOutdated = false;
					bool docOutdated = AppleDocHandler.CheckAppleDocFreshness (AppleDocHandler.IosAtomFeed, out infos);
					if (!docOutdated)
						mergeOutdated = AppleDocHandler.CheckMergedDocumentationFreshness (infos);
					return Tuple.Create (docOutdated || mergeOutdated, docOutdated, mergeOutdated);
				}).ContinueWith (t => {
					Console.WriteLine ("Merged status {0}", t.Result);
					if (!t.Result.Item1)
						return;
					BeginInvokeOnMainThread (() => LaunchDocumentationUpdate (t.Result.Item2, t.Result.Item3));
				});
			}
		}
Пример #25
0
		public override void FinishedLaunching (NSObject notification)
		{
			testWindowController = new TestWindowController ();
			testWindowController.Window.MakeKeyAndOrderFront (this);
			
			
		}
Пример #26
0
		public static void RemoveAction (NSObject target, EventHandler handler)
		{
			ActionDispatcher ctarget = target as ActionDispatcher;
			if (ctarget == null)
				return;
			ctarget.Activated -= handler;
		}
Пример #27
0
		public override void FinishedLaunching(NSObject notification)
		{
			// On the Mac, we are running on Mono - emit the Mono revision
			var monoVersion = "None";
			Type monoRuntimeType;
			MethodInfo getDisplayNameMethod;
			if ((monoRuntimeType = typeof(object).Assembly.GetType("Mono.Runtime")) != null &&
				(getDisplayNameMethod = monoRuntimeType.GetMethod(
					"GetDisplayName",
					BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding, null,
					Type.EmptyTypes, null)) != null)
			{
				monoVersion = string.Format("Mono {0}", getDisplayNameMethod.Invoke(null, null));
			}

			logger.Info("Finished launching: .NET {0} ({1}); startedSlideshow = {2}", System.Environment.Version, monoVersion, startedSlideshow);
			if (!startedSlideshow)
			{
                Preferences<WatchThisPreferences>.Load(
				    Path.Combine(
    					Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
    					"Library",
    					"Preferences",
    					"WatchThis.rangic.json"));

				controller = new ShowListController();
				controller.Window.MakeKeyAndOrderFront(this);
			}
		}
Пример #28
0
        public override void FinishedLaunching (NSObject notification)
        {
            RxApp.MutableResolver.Register(() => new TestViewController(), typeof(IViewFor<TestViewModel>));

            mainWindowController = new MainWindowController ();
            mainWindowController.Window.MakeKeyAndOrderFront (this);
        }
Пример #29
0
		public static void DecideIgnore (NSObject decisionToken)
		{
			if (decisionToken == null)
				throw new ArgumentNullException ("decisionToken");
			
			MonoMac.ObjCRuntime.Messaging.void_objc_msgSend (decisionToken.Handle, selIgnore);
		}
Пример #30
0
        public override void FinishedLaunching(NSObject notification)
        {
            Engine.Instance.TerminateEvent += delegate() {
                new NSObject ().InvokeOnMainThread (() => {
                    //NSApplication.SharedApplication.ReplyToApplicationShouldTerminate (true);
                    NSApplication.SharedApplication.Terminate(new NSObject ());
                });
            };

            UpdateInterfaceStyle ();

            mainWindowController = new MainWindowController ();

            bool startVisible = Engine.Instance.Storage.GetBool("gui.osx.visible");
            if (startVisible) {
                mainWindowController.Window.MakeKeyAndOrderFront (this);
            } else {
                mainWindowController.Window.IsVisible = false;
            }
            NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);

            NSProcessInfo.ProcessInfo.DisableSuddenTermination (); // Already disabled by default

            MenuEvents ();
        }
Пример #31
0
        partial void ShowPreferencesDialog(MonoMac.Foundation.NSObject sender)
        {
            PreferencesDialogController prefs = new PreferencesDialogController();

            prefs.Window.MakeKeyAndOrderFront(this.mainWindow);
            prefs.Window.SetFrameTopLeftPoint(new PointF(
                                                  mainWindow.Frame.Left +
                                                  ((mainWindow.Frame.Right - prefs.Window.Frame.Right) / 2),
                                                  mainWindow.Frame.Bottom - 20));
            NSApplication.SharedApplication.RunModalForWindow(prefs.Window);
        }
Пример #32
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();
 }
Пример #33
0
        partial void ShowAboutDialog(MonoMac.Foundation.NSObject sender)
        {
            AboutDialogController about = new AboutDialogController();

            about.Window.MakeKeyAndOrderFront(this.mainWindow);
            about.Window.SetFrameTopLeftPoint(new PointF(
                                                  mainWindow.Frame.Left +
                                                  ((mainWindow.Frame.Right - about.Window.Frame.Right) / 2),
                                                  mainWindow.Frame.Bottom - 35));
            NSApplication.SharedApplication.RunModalForWindow(about.Window);
        }
Пример #34
0
        public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
        {
            /*
             * using (game = new ChessGame())
             * {
             *      game.Run ();
             * }
             */

            game = new ChessGame();
            game.Run();
        }
Пример #35
0
 public void Stop()
 {
     if (_video != null)
     {
         MonoMac.Foundation.NSObject o = new MonoMac.Foundation.NSObject();
         _video.MovieView.Pause(o);
         _video.MovieView.GotoBeginning(o);
         _state             = MediaState.Stopped;
         Game._playingVideo = false;
         _video.MovieView.RemoveFromSuperview();
     }
 }
Пример #36
0
        public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
        {
            /* Create a listener that outputs to the console screen, and
             * add it to the debug listeners. */
            TextWriterTraceListener debugConsoleWriter = new
                                                         TextWriterTraceListener(System.Console.Out);

            Debug.Listeners.Add(debugConsoleWriter);

            // Fun begins..
            CampfireNet.Simulator.EntryPoint.Run();
        }
Пример #37
0
 partial void btnDown_Clicked(MonoMac.Foundation.NSObject sender)
 {
     if (tblCdda.SelectedRow >= 0 && tblCdda.SelectedRow < _tracks.Rows.Count - 1)
     {
         int      idx  = tblCdda.SelectedRow;
         CddaItem item = _tracks.Rows[idx];
         _tracks.Rows.RemoveAt(idx);
         _tracks.Rows.Insert(idx + 1, item);
         tblCdda.ReloadData();
         tblCdda.SelectRow(idx + 1, false);
     }
 }
        partial void OnContinue(MonoMac.Foundation.NSObject sender)
        {
            ServerCredentials credentials = new ServerCredentials()
            {
                UserName = UserText.StringValue,
                Password = PasswordText.StringValue,
                Address  = new Uri(AddressText.StringValue),
                Binding  = (this.Controller.saved_binding == null) ? ServerCredentials.BindingBrowser : this.Controller.saved_binding
            };

            WarnText.StringValue   = string.Empty;
            AddressText.Enabled    = false;
            UserText.Enabled       = false;
            PasswordText.Enabled   = false;
            ContinueButton.Enabled = false;
            CancelButton.Enabled   = false;
            //  monomac bug: animation GUI effect will cause GUI to hang, when backend thread is busy
//            LoginProgress.StartAnimation(this);
            Thread check = new Thread(() => {
                var result = SetupController.GetRepositories(credentials);
                if (result.Repositories != null)
                {
                    this.Controller.repositories = result.Repositories.WithoutHiddenOnce();
                }
                else
                {
                    this.Controller.repositories = null;
                }

                InvokeOnMainThread(delegate {
                    if (this.Controller.repositories == null)
                    {
                        AddressText.StringValue = result.Credentials.Address.ToString();
                        WarnText.StringValue    = this.Controller.GetConnectionsProblemWarning(result.FailedException);
                        AddressText.Enabled     = true;
                        UserText.Enabled        = true;
                        PasswordText.Enabled    = true;
                        ContinueButton.Enabled  = true;
                        CancelButton.Enabled    = true;
                    }
                    else
                    {
                        RemoveEvent();
                        Controller.Add1PageCompleted(result.Credentials.Address, result.Credentials.Binding, credentials.UserName, credentials.Password.ToString());
                    }

                    LoginProgress.StopAnimation(this);
                });
            });

            check.Start();
        }
Пример #39
0
 partial void OnFinish(MonoMac.Foundation.NSObject sender)
 {
     lock (loginLock)
     {
         isClosed = true;
     }
     Loader.Cancel();
     RemoveEvent();
     Ignores = NodeModelUtils.GetIgnoredFolder(Repo);
     Credentials.Password = PasswordText.StringValue;
     Controller.SaveFolder();
     Controller.CloseWindow();
 }
Пример #40
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();
 }
        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;
            }
        }
Пример #42
0
        partial void btnBrowseData_Clicked(MonoMac.Foundation.NSObject sender)
        {
            NSOpenPanel openPanel = NSOpenPanel.OpenPanel;

            openPanel.CanChooseDirectories = true;
            openPanel.CanChooseFiles       = false;
            openPanel.BeginSheet(Window, ((int result) => {
                if (result == (int)NSPanelButtonType.Ok)
                {
                    txtData.Cell.Title = openPanel.Url.Path;
                }
            }));
        }
Пример #43
0
        partial void btnAdvanced_Clicked(MonoMac.Foundation.NSObject sender)
        {
            txtVolumeId.Cell.Title      = _builder.VolumeIdentifier;
            txtSystemId.Cell.Title      = _builder.SystemIdentifier;
            txtVolSetId.Cell.Title      = _builder.VolumeSetIdentifier;
            txtPublisherId.Cell.Title   = _builder.PublisherIdentifier;
            txtDataPreparer.Cell.Title  = _builder.DataPreparerIdentifier;
            txtApplicationId.Cell.Title = _builder.ApplicationIdentifier;
            chkTruncateMode.State       = (_builder.TruncateData)?NSCellStateValue.On:NSCellStateValue.Off;

            //This is deprecated and we shouldn't be using it. Thanks Xamarin... :-(
            NSApplication.SharedApplication.BeginSheet(winAdvanced, Window);
        }
Пример #44
0
        partial void btnAdvOK_Clicked(MonoMac.Foundation.NSObject sender)
        {
            _builder.VolumeIdentifier       = txtVolumeId.Cell.Title;
            _builder.SystemIdentifier       = txtSystemId.Cell.Title;
            _builder.VolumeSetIdentifier    = txtVolSetId.Cell.Title;
            _builder.PublisherIdentifier    = txtPublisherId.Cell.Title;
            _builder.DataPreparerIdentifier = txtDataPreparer.Cell.Title;
            _builder.ApplicationIdentifier  = txtApplicationId.Cell.Title;
            _builder.TruncateData           = (chkTruncateMode.State == NSCellStateValue.On);

            NSApplication.SharedApplication.EndSheet(winAdvanced);
            winAdvanced.OrderOut(winAdvanced);
        }
Пример #45
0
        partial void ShowPreferenceWindow(MonoMac.Foundation.NSObject sender)
        {
            Console.WriteLine("I can has perfences?");
            if (_preferencesWindowController == null)
            {
                _preferencesWindowController = new PreferencesWindowController();
            }

            //NSApplication.SharedApplication.RunModalForWindow(_preferencesWindowController.Window);
            _preferencesWindowController.ShowWindow(this);
            _preferencesWindowController.Window.Level = NSWindowLevel.Status;
            //_preferencesWindowController.Window.MakeMainWindow();
        }
Пример #46
0
        partial void SwitchView(MonoMac.Foundation.NSObject sender)
        {
            switch (viewSwitcher.SelectedSegment)
            {
            case 0:
                SwitchToController(listViewController);
                break;

            case 1:
                SwitchToController(gridViewController);
                break;
            }
        }
Пример #47
0
        private void PlatformStop()
        {
            var movieView = _currentVideo.MovieView;

            MonoMac.Foundation.NSObject o = new MonoMac.Foundation.NSObject();
            movieView.Pause(o);
            movieView.GotoBeginning(o);

            // FIXME: I'm not crazy about keeping track of IsPlayingVideo in MacGamePlatform, but where else can
            //        this concept be expressed?
            _platform.IsPlayingVideo = false;
            movieView.RemoveFromSuperview();
        }
Пример #48
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();
 }
Пример #49
0
 public void Stop()
 {
     if (_video != null)
     {
         MonoMac.Foundation.NSObject o = new MonoMac.Foundation.NSObject();
         _video.MovieView.Pause(o);
         _video.MovieView.GotoBeginning(o);
         _state = MediaState.Stopped;
         // FIXME: I'm not crazy about keeping track of IsPlayingVideo in MacGamePlatform, but where else can
         //        this concept be expressed?
         _platform.IsPlayingVideo = false;
         _video.MovieView.RemoveFromSuperview();
     }
 }
Пример #50
0
        partial void OnContinue(MonoMac.Foundation.NSObject sender)
        {
            ServerCredentials credentials = new ServerCredentials()
            {
                UserName = UserText.StringValue,
                Password = PasswordText.StringValue,
                Address  = new Uri(AddressText.StringValue)
            };

            WarnText.StringValue   = String.Empty;
            AddressText.Enabled    = false;
            UserText.Enabled       = false;
            PasswordText.Enabled   = false;
            ContinueButton.Enabled = false;
            CancelButton.Enabled   = false;
            //  monomac bug: animation GUI effect will cause GUI to hang, when backend thread is busy
//            LoginProgress.StartAnimation(this);
            Thread check = new Thread(() => {
                Tuple <CmisServer, Exception> fuzzyResult = CmisUtils.GetRepositoriesFuzzy(credentials);
                CmisServer cmisServer = fuzzyResult.Item1;
                if (cmisServer != null)
                {
                    Controller.repositories = cmisServer.Repositories;
                }
                else
                {
                    Controller.repositories = null;
                }
                InvokeOnMainThread(delegate {
                    if (Controller.repositories == null)
                    {
                        WarnText.StringValue   = Controller.GetConnectionsProblemWarning(fuzzyResult.Item1, fuzzyResult.Item2);
                        AddressText.Enabled    = true;
                        UserText.Enabled       = true;
                        PasswordText.Enabled   = true;
                        ContinueButton.Enabled = true;
                        CancelButton.Enabled   = true;
                    }
                    else
                    {
                        RemoveEvent();
                        Controller.Add1PageCompleted(cmisServer.Url, credentials.UserName, credentials.Password.ToString());
                    }
                    LoginProgress.StopAnimation(this);
                });
            });

            check.Start();
        }
Пример #51
0
        partial void OnContinue(MonoMac.Foundation.NSObject sender)
        {
            RootFolder root = Repositories.Find(x => (x.Selected != false));

            if (root != null)
            {
                RemoveEvent();
                foreach (AsyncNodeLoader task in Loader.Values)
                {
                    task.Cancel();
                }
                Controller.saved_repository = root.Id;
                Controller.Add2PageCompleted(Controller.saved_repository, Controller.saved_remote_path);
            }
        }
Пример #52
0
        public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
        {
            wnd = new SciterWindow();
            wnd.CreateMainWindow(500, 500);
            wnd.CenterTopLevelWindow();
            wnd.Title = "SciterSharp from OSX";

            host = new Host();
            host.SetupWindow(wnd);
            host.AttachEvh(new HostEvh());
            host.SetupPage("index.html");
            host.DebugInspect();

            wnd.Show();
        }
Пример #53
0
        partial void btnBrowseIpBin_Clicked(MonoMac.Foundation.NSObject sender)
        {
            NSOpenPanel openPanel = NSOpenPanel.OpenPanel;

            openPanel.CanChooseFiles       = true;
            openPanel.CanChooseDirectories = false;
            openPanel.AllowedFileTypes     = new [] { "bin" };
            openPanel.AllowsOtherFileTypes = false;
            openPanel.BeginSheet(Window, ((int result) => {
                if (result == (int)NSPanelButtonType.Ok)
                {
                    txtIpBin.Cell.Title = openPanel.Url.Path;
                }
            }));
        }
Пример #54
0
        partial void signInClicked(MonoMac.Foundation.NSObject sender)
        {
            Console.WriteLine("Sign in clicked");

            var appDelegate = (NSApplication.SharedApplication.Delegate as AppDelegate);

            if (appDelegate.Account == null || !appDelegate.Account.IsAuthenticated)
            {
                SignIn();
            }
            else
            {
                appDelegate.Account = null;
                SignOut();
            }
        }
Пример #55
0
        partial void OnContinue(MonoMac.Foundation.NSObject sender)
        {
            RootFolder root = Repositories.Find(x => (x.Selected != false));

            if (root != null)
            {
                RemoveEvent();
                foreach (AsyncNodeLoader task in Loader.Values)
                {
                    task.Cancel();
                }
                Controller.saved_repository = root.Id;
                List <string> ignored  = NodeModelUtils.GetIgnoredFolder(root);
                List <string> selected = NodeModelUtils.GetSelectedFolder(root);
                Controller.Add2PageCompleted(root.Id, root.Path, ignored.ToArray(), selected.ToArray());
            }
        }
Пример #56
0
        partial void OnContinue(MonoMac.Foundation.NSObject sender)
        {
            ServerCredentials credentials = new ServerCredentials()
            {
                UserName = UserText.StringValue,
                Password = PasswordText.StringValue,
                Address  = new Uri(AddressText.StringValue)
            };

            AddressText.Enabled    = false;
            UserText.Enabled       = false;
            PasswordText.Enabled   = false;
            ContinueButton.Enabled = false;
            CancelButton.Enabled   = false;

            Thread check = new Thread(() => {
                Tuple <CmisServer, Exception> fuzzyResult = CmisUtils.GetRepositoriesFuzzy(credentials);
                CmisServer cmisServer = fuzzyResult.Item1;
                if (cmisServer != null)
                {
                    Controller.repositories = cmisServer.Repositories;
                }
                else
                {
                    Controller.repositories = null;
                }
                InvokeOnMainThread(delegate {
                    if (Controller.repositories == null)
                    {
                        WarnText.StringValue   = Controller.getConnectionsProblemWarning(fuzzyResult.Item1, fuzzyResult.Item2);
                        AddressText.Enabled    = true;
                        UserText.Enabled       = true;
                        PasswordText.Enabled   = true;
                        ContinueButton.Enabled = true;
                        CancelButton.Enabled   = true;
                    }
                    else
                    {
                        RemoveEvent();
                        Controller.Add1PageCompleted(cmisServer.Url, credentials.UserName, credentials.Password.ToString());
                    }
                });
            });

            check.Start();
        }
        partial void OnOpen(MonoMac.Foundation.NSObject sender)
        {
            if (TableView.SelectedRowCount <= 0)
            {
                return;
            }

            NSWorkspace.SharedWorkspace.BeginInvokeOnMainThread(delegate {
                foreach (int row in TableView.SelectedRows)
                {
                    var item = DataSource.GetTransmissionItem(row);
                    if (item != null && item.Done)
                    {
                        NSWorkspace.SharedWorkspace.OpenFile(item.Path);
                    }
                }
            });
        }
Пример #58
0
        partial void SwitchIsInSeries(MonoMac.Foundation.NSObject sender)
        {
            if (!IsPartOfSeries)
            {
                seriesStartField.StringValue = "";
                seriesField.StringValue      = "";
                seriesEndField.StringValue   = "";

                seriesField.Enabled      = false;
                seriesStartField.Enabled = false;
                seriesEndField.Enabled   = false;
            }
            else
            {
                seriesField.Enabled      = true;
                seriesStartField.Enabled = true;
                seriesEndField.Enabled   = true;
            }
        }
Пример #59
0
        partial void checkboxAction(MonoMac.Foundation.NSObject sender)
        {
            var button    = (NSButton)sender;
            var isChecked = button.State == NSCellStateValue.On;

            if (button.Equals(centerFullScreenButton))
            {
                Window.CenterFullScreenButton = isChecked;
                return;
            }
            if (button.Equals(showBaselineSeparatorButton))
            {
                Window.ShowBaselineSeparator = isChecked;
                return;
            }
            if (button.Equals(centerTrafficLightButton))
            {
                Window.CenterTrafficLightButtons = isChecked;
                return;
            }
            if (button.Equals(verticalTrafficLightButton))
            {
                Window.VerticalTrafficLightButtons = isChecked;
                return;
            }
            if (button.Equals(verticallyCenterTitleButton))
            {
                Window.VerticallyCenterTitle = isChecked;
                return;
            }
            if (button.Equals(texturedWindowButton))
            {
                if (isChecked)
                {
                    Window.StyleMask |= NSWindowStyle.TexturedBackground;
                }
                else
                {
                    Window.StyleMask &= ~NSWindowStyle.TexturedBackground;
                }
                return;
            }
        }
Пример #60
0
        partial void btnAdd_Clicked(MonoMac.Foundation.NSObject sender)
        {
            NSOpenPanel openPanel = NSOpenPanel.OpenPanel;

            openPanel.CanChooseFiles          = true;
            openPanel.CanChooseDirectories    = false;
            openPanel.AllowedFileTypes        = new [] { "raw" };
            openPanel.AllowsOtherFileTypes    = false;
            openPanel.AllowsMultipleSelection = true;
            openPanel.BeginSheet(Window, ((int result) => {
                if (result == (int)NSPanelButtonType.Ok)
                {
                    foreach (NSUrl url in openPanel.Urls)
                    {
                        _tracks.Rows.Add(new CddaItem(url.Path));
                    }
                    tblCdda.ReloadData();
                }
            }));
        }