コード例 #1
0
ファイル: AppDelegate.cs プロジェクト: pbbpage/mac-samples
		void OpenDialog (NSObject sender)
		{
			var dlg = NSOpenPanel.OpenPanel;
			dlg.CanChooseFiles = true;
			dlg.CanChooseDirectories = false;

			if (dlg.RunModal () == 1) {
				// Nab the first file
				var url = dlg.Urls [0];

				if (url != null) {
					var path = url.Path;

					// Create a new window to hold the text
					var newWindowController = new MainWindowController ();
					newWindowController.Window.MakeKeyAndOrderFront (this);

					// Load the text into the window
					var window = newWindowController.Window as MainWindow;
					window.Text = File.ReadAllText(path);
					window.SetTitleWithRepresentedFilename (Path.GetFileName(path));
					window.RepresentedUrl = url;

				}
			}

		}
コード例 #2
0
ファイル: AppDelegate.cs プロジェクト: pbbpage/mac-samples
		public override void DidFinishLaunching (NSNotification notification)
		{
			// Open main window
			mainWindowController = new MainWindowController ();
			mainWindowController.Window.MakeKeyAndOrderFront (this);
			mainWindowController.Window.Title = "untitled";

			// Display panel
			var panel = new DocumentPanelController ();
			panel.Window.MakeKeyAndOrderFront (this);
		}
コード例 #3
0
ファイル: AppDelegate.cs プロジェクト: pbbpage/mac-samples
		void NewDocument (NSObject sender) {
			var newWindowController = new MainWindowController ();
			newWindowController.Window.MakeKeyAndOrderFront (this);
			newWindowController.Window.Title = (++UntitledWindowCount == 1) ? "untitled" : string.Format ("untitled {0}", UntitledWindowCount);
		}