Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
[CustomFont] Update metadata + fix static analyzer issues
Browse files Browse the repository at this point in the history
  • Loading branch information
olegoid committed Oct 30, 2015
1 parent 5dcfea1 commit 5e9aedc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 31 deletions.
25 changes: 9 additions & 16 deletions CustomFont/CustomFont/AppDelegate.cs
@@ -1,21 +1,13 @@
using System;

using Foundation;
using AppKit;
using AppKit;
using CoreGraphics;
using Foundation;

namespace TestFont
{
public partial class AppDelegate : NSApplicationDelegate
{
#region Private Variables
private MainWindowController mainWindowController;
#endregion

#region Constructors
public AppDelegate ()
{
}
MainWindowController mainWindowController;
#endregion

#region Override Methods
Expand All @@ -26,12 +18,13 @@ public override void DidFinishLaunching (NSNotification notification)
mainWindowController.Window.MakeKeyAndOrderFront (this);

// Create a text field with the custom font and add it to the main window
var lab1 = new NSTextField(new CGRect(0,0, 300, 100));
lab1.StringValue = "This is some sample text";
lab1.Editable = false;
lab1.Font = NSFont.FromFontName ("SF Hollywood Hills", 20f);
mainWindowController.Window.ContentView.AddSubview (lab1);
var lab1 = new NSTextField (new CGRect (0.0, 0.0, 300.0, 100.0)) {
StringValue = "This is some sample text",
Editable = false,
Font = NSFont.FromFontName ("SF Hollywood Hills", 20f)
};

mainWindowController.Window.ContentView.AddSubview (lab1);
}
#endregion
}
Expand Down
5 changes: 0 additions & 5 deletions CustomFont/CustomFont/MainWindow.cs
Expand Up @@ -15,10 +15,5 @@ public MainWindow (IntPtr handle) : base (handle)
public MainWindow (NSCoder coder) : base (coder)
{
}

public override void AwakeFromNib ()
{
base.AwakeFromNib ();
}
}
}
15 changes: 6 additions & 9 deletions CustomFont/CustomFont/MainWindowController.cs
Expand Up @@ -7,6 +7,12 @@ namespace TestFont
{
public partial class MainWindowController : NSWindowController
{
public new MainWindow Window {
get {
return (MainWindow)base.Window;
}
}

public MainWindowController (IntPtr handle) : base (handle)
{
}
Expand All @@ -19,14 +25,5 @@ public MainWindowController (NSCoder coder) : base (coder)
public MainWindowController () : base ("MainWindow")
{
}

public override void AwakeFromNib ()
{
base.AwakeFromNib ();
}

public new MainWindow Window {
get { return (MainWindow)base.Window; }
}
}
}
3 changes: 2 additions & 1 deletion CustomFont/Metadata.xml
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<SampleMetadata>
<ID>0063f646-f6c7-42fa-bceb-c95eb36b67b6</ID>
<IsFullApplication>true</IsFullApplication>
<IsFullApplication>false</IsFullApplication>
<Level>Beginning</Level>
<Tags>Getting Started, User Interface</Tags>
<SupportedPlatforms>Mac</SupportedPlatforms>
<Gallery>true</Gallery>
<Brief>Demonstrates how to use Custom Fonts embedded in a Xamarin.Mac application.</Brief>
</SampleMetadata>

0 comments on commit 5e9aedc

Please sign in to comment.