This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Adapt the Growl sample to work with Xamarin.Mac using Xamarin.Growl.d…
…ll (MonoMac still has Growl support until the next update/release of MonoDevelop)
- Loading branch information
Showing
6 changed files
with
81 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
bin/ | ||
obj/ | ||
mono/ | ||
xamarin/ | ||
*.dll* | ||
*.userprefs | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,12 @@ | ||
using System; | ||
using System.Runtime; | ||
using System.IO; | ||
using System.Drawing; | ||
using MonoMac.Foundation; | ||
using MonoMac.AppKit; | ||
using MonoMac.ObjCRuntime; | ||
|
||
namespace TwoMinuteGrowler { | ||
class MainClass { | ||
static void Main ( string[] args ) { | ||
|
||
var baseAppPath = Directory.GetParent (Directory.GetParent (System.AppDomain.CurrentDomain.BaseDirectory).ToString ()); | ||
//var growlPath = baseAppPath + "/Frameworks/Growl-WithInstaller.framework/Growl-WithInstaller"; | ||
var growlPath = baseAppPath + "/Frameworks/Growl.framework/Growl"; | ||
|
||
Dlfcn.dlopen (growlPath, 0); | ||
|
||
static void Main (string[] args) | ||
{ | ||
NSApplication.Init (); | ||
NSApplication.Main (args); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,41 @@ | ||
|
||
using System; | ||
using System.IO; | ||
using MonoMac.AppKit; | ||
using MonoMac.Foundation; | ||
using MonoMac.ObjCRuntime; | ||
|
||
namespace TwoMinuteGrowler { | ||
|
||
public partial class MainWindow : NSWindow { | ||
|
||
namespace TwoMinuteGrowler | ||
{ | ||
public partial class MainWindow : MonoMac.AppKit.NSWindow | ||
{ | ||
public MainWindow (IntPtr handle) : base(handle) {} | ||
public MainWindow (IntPtr handle) : base (handle) | ||
{ | ||
Initialize (); | ||
} | ||
|
||
[Export("initWithCoder:")] | ||
public MainWindow (NSCoder coder) : base(coder) {} | ||
} | ||
} | ||
public MainWindow (NSCoder coder) : base (coder) | ||
{ | ||
Initialize (); | ||
} | ||
|
||
void Initialize () | ||
{ | ||
// First check if Growl is available globally | ||
string growlPath = "/Library/Frameworks/Growl.framework/Growl"; | ||
// if not... | ||
if (!File.Exists (growlPath)) { | ||
// then look if the application is bundling the framework | ||
growlPath = Path.Combine (NSBundle.MainBundle.ExecutablePath, "../../Frameworks/Growl.framework/Growl"); | ||
} | ||
// Try loading the framework | ||
if (Dlfcn.dlopen (growlPath, 0) == IntPtr.Zero) { | ||
// if we can't then show some instructions | ||
NSAlert alert = NSAlert.WithMessage ("Missing Growl.framework", "Quit", null, null, | ||
"See README.md for the additional requirements"); | ||
alert.RunSheetModal (this); | ||
NSApplication.SharedApplication.Terminate (this); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters