-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jonlipsky
authored
Jul 3, 2023
1 parent
78fe222
commit 9582b3f
Showing
30 changed files
with
1,281 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using AppKit; | ||
using CoreGraphics; | ||
using Foundation; | ||
using Sentry; | ||
|
||
namespace Sample.Xamarin.Mac | ||
{ | ||
[Register("AppDelegate")] | ||
public class AppDelegate : NSApplicationDelegate | ||
{ | ||
private SampleWindowController _windowController; | ||
|
||
public override void DidFinishLaunching(NSNotification notification) | ||
{ | ||
SentryXamarin.Init(options => | ||
{ | ||
options.Dsn = "https://5a193123a9b841bc8d8e42531e7242a1@o447951.ingest.sentry.io/5560112"; | ||
options.Debug = true; | ||
}); | ||
|
||
_windowController = new SampleWindowController(); | ||
|
||
var screenRect = NSScreen.MainScreen.VisibleFrame; | ||
var offsetFromLeft = 10; | ||
var offsetFromTop = 10; | ||
var offsetFromBottom = screenRect.GetMaxY() - _windowController.Window.Frame.Height - offsetFromTop; | ||
|
||
_windowController.Window.SetFrameOrigin(new CGPoint(offsetFromLeft, offsetFromBottom)); | ||
_windowController.Window.MakeKeyAndOrderFront(this); | ||
} | ||
|
||
public override void WillTerminate(NSNotification notification) | ||
{ | ||
// Insert code here to tear down your application | ||
} | ||
} | ||
} |
Binary file added
BIN
+7.93 KB
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.3 KB
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-128@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+711 Bytes
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.45 KB
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-16@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.3 KB
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+57.9 KB
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-256@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.45 KB
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.35 KB
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-32@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+57.9 KB
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+173 KB
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions
68
Samples/Sample.Xamarin.Mac/Assets.xcassets/AppIcon.appiconset/Contents.json
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"images": [ | ||
{ | ||
"filename": "AppIcon-16.png", | ||
"size": "16x16", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-16@2x.png", | ||
"size": "16x16", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-32.png", | ||
"size": "32x32", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-32@2x.png", | ||
"size": "32x32", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-128.png", | ||
"size": "128x128", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-128@2x.png", | ||
"size": "128x128", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-256.png", | ||
"size": "256x256", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-256@2x.png", | ||
"size": "256x256", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-512.png", | ||
"size": "512x512", | ||
"scale": "1x", | ||
"idiom": "mac" | ||
}, | ||
{ | ||
"filename": "AppIcon-512@2x.png", | ||
"size": "512x512", | ||
"scale": "2x", | ||
"idiom": "mac" | ||
} | ||
], | ||
"info": { | ||
"version": 1, | ||
"author": "xcode" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
</dict> | ||
</plist> |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleName</key> | ||
<string>Sample.Xamarin.Mac</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.companyname.Sample.Xamarin.Mac</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>${AuthorCopyright:HtmlEncode}</string> | ||
<key>NSPrincipalClass</key> | ||
<string>NSApplication</string> | ||
<key>NSMainStoryboardFile</key> | ||
<string>Main</string> | ||
<key>XSAppIconAssets</key> | ||
<string>Assets.xcassets/AppIcon.appiconset</string> | ||
<key>LSMinimumSystemVersion</key> | ||
<string>10.14</string> | ||
</dict> | ||
</plist> |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using AppKit; | ||
|
||
namespace Sample.Xamarin.Mac | ||
{ | ||
static class MainClass | ||
{ | ||
static void Main (string [] args) | ||
{ | ||
NSApplication.Init (); | ||
NSApplication.Main (args); | ||
} | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="MSBuild.Sdk.Extras/2.0.41" DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{1204E055-1BA8-4803-B98C-36C2CE608A54}</ProjectGuid> | ||
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Sample.Xamarin.Mac</RootNamespace> | ||
<AssemblyName>Sample.Xamarin.Mac</AssemblyName> | ||
<TargetFramework>xamarinmac20</TargetFramework> | ||
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug</OutputPath> | ||
<DefineConstants>DEBUG;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<EnableCodeSigning>false</EnableCodeSigning> | ||
<CodesigningKey>Mac Developer</CodesigningKey> | ||
<CreatePackage>false</CreatePackage> | ||
<EnablePackageSigning>false</EnablePackageSigning> | ||
<IncludeMonoRuntime>false</IncludeMonoRuntime> | ||
<UseSGen>true</UseSGen> | ||
<UseRefCounting>true</UseRefCounting> | ||
<HttpClientHandler>NSUrlSessionHandler</HttpClientHandler> | ||
<LinkMode>SdkOnly</LinkMode> | ||
<XamMacArch>x86_64</XamMacArch> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<EnableCodeSigning>false</EnableCodeSigning> | ||
<CreatePackage>true</CreatePackage> | ||
<EnablePackageSigning>false</EnablePackageSigning> | ||
<IncludeMonoRuntime>true</IncludeMonoRuntime> | ||
<UseSGen>true</UseSGen> | ||
<UseRefCounting>true</UseRefCounting> | ||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> | ||
<LinkMode>SdkOnly</LinkMode> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="Xamarin.Mac" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128.png" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128%402x.png" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16.png" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16%402x.png" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256.png" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256%402x.png" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32.png" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32%402x.png" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512.png" /> | ||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512%402x.png" /> | ||
<ImageAsset Include="Assets.xcassets\Contents.json" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Info.plist" /> | ||
<None Include="Entitlements.plist" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<InterfaceDefinition Include="Main.storyboard" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\Src\Sentry.Xamarin\Sentry.Xamarin.csproj"> | ||
<Project>{c911dd4b-bcdc-4d76-83d1-dc40379df816}</Project> | ||
<Name>Sentry.Xamarin</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
</Project> |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using AppKit; | ||
using CoreGraphics; | ||
using Sentry; | ||
|
||
namespace Sample.Xamarin.Mac | ||
{ | ||
public class SampleView : NSView | ||
{ | ||
private readonly List<NSView> _views = new List<NSView>(); | ||
|
||
public SampleView() | ||
{ | ||
InitializeButtons(); | ||
} | ||
|
||
public override bool IsFlipped => true; | ||
|
||
public override void Layout() | ||
{ | ||
var bounds = Bounds; | ||
|
||
if (bounds.IsEmpty) return; | ||
|
||
var y = 40; | ||
foreach (var view in _views) | ||
{ | ||
view.Frame = new CGRect(10, y, 300, 28); | ||
y += 38; | ||
} | ||
} | ||
|
||
private void InitializeButtons() | ||
{ | ||
AddButton("Throw managed exception (uncaught)", ThrowManagedExceptionUncaught); | ||
AddButton("Throw managed exception (caught)", ThrowManagedExceptionCaught); | ||
Layout(); | ||
} | ||
|
||
private void ThrowManagedExceptionUncaught() | ||
{ | ||
throw new Exception("Managed exception"); | ||
} | ||
|
||
private void ThrowManagedExceptionCaught() | ||
{ | ||
try | ||
{ | ||
throw new Exception("Managed exception (caught)"); | ||
} | ||
catch (Exception e) | ||
{ | ||
SentrySdk.CaptureException(e); | ||
} | ||
} | ||
|
||
private void AddButton(string title, Action action) | ||
{ | ||
var button = new NSButton(); | ||
button.BezelStyle = NSBezelStyle.Rounded; | ||
button.SetButtonType(NSButtonType.MomentaryPushIn); | ||
button.Title = title; | ||
button.Activated += (_, _) => | ||
{ | ||
action.Invoke(); | ||
}; | ||
|
||
_views.Add(button); | ||
AddSubview(button); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using AppKit; | ||
|
||
namespace Sample.Xamarin.Mac | ||
{ | ||
public class SampleViewController : NSViewController | ||
{ | ||
private SampleView _view; | ||
|
||
public override void LoadView() | ||
{ | ||
_view = new SampleView(); | ||
base.View = _view; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using AppKit; | ||
using CoreGraphics; | ||
|
||
namespace Sample.Xamarin.Mac | ||
{ | ||
public class SampleWindow : NSWindow | ||
{ | ||
private SampleViewController _sampleViewController; | ||
|
||
public SampleWindow(IntPtr handle) : base(handle) | ||
{ | ||
Initialize(); | ||
} | ||
|
||
public SampleWindow() | ||
{ | ||
Initialize(); | ||
} | ||
|
||
void Initialize() | ||
{ | ||
SetFrame(new CGRect(0, 0, 1024, 768), true, true); | ||
StyleMask = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled | NSWindowStyle.FullSizeContentView; | ||
Title = "Sentry Xamarin.Mac Sample"; | ||
|
||
_sampleViewController = new SampleViewController(); | ||
|
||
ContentView.AutoresizesSubviews = true; | ||
ContentView.AutoresizingMask = NSViewResizingMask.WidthSizable | NSViewResizingMask.HeightSizable; | ||
_sampleViewController.View.Frame = ContentView.Bounds; | ||
ContentView.AddSubview(_sampleViewController.View); | ||
} | ||
} | ||
} |
Oops, something went wrong.