Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Clancey committed Dec 23, 2013
1 parent 089fd86 commit 370d702
Show file tree
Hide file tree
Showing 98 changed files with 6,854 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
109 changes: 109 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/

# mstest test results
TestResults

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates
Thumbs.db

# Build results
[Dd]ebug/
[Rr]elease/
x64/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.log
*.vspscc
*.vssscc
.builds

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Publish Web Output
*.Publish.xml

# NuGet Packages Directory
packages

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/
[Cc]omponents
# Others
[Bb]in
[Oo]bj
sql
TestResults
[Tt]est[Rr]esult*
*.Cache
ClientBin
[Ss]tyle[Cc]op.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
59 changes: 59 additions & 0 deletions MyCompany.Visitors.Client.iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MyCompany.Visitors.Client.iOS.ViewController;
using MyCompany.Visitors.Client.iOS.ViewControllers;
using MyCompany.Visitors.Client;
namespace MyCompany.Visitors.Client.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{

public static MyCompanyClient CompanyClient { get; private set; }
// class-level declarations
UIWindow window;

//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
app.IdleTimerDisabled = true;
// create a new window instance based on the screen size
window = new UIWindow(UIScreen.MainScreen.Bounds)
{
TintColor = Theme.AccentColor
};
// If you have defined a view, add it here:
// window.RootViewController = navigationController;

CompanyClient = createCompanyClient();

window.RootViewController = new UINavigationController (new MainViewController());

window.MakeKeyAndVisible();
NSNotificationCenter.DefaultCenter.AddObserver("NSUserDefaultsDidChangeNotification", (n) =>
{
CompanyClient = createCompanyClient();
Console.WriteLine("url changed");
});
return true;
}

MyCompanyClient createCompanyClient()
{
return new MyCompanyClient (AppSettings.ApiUri.ToString () + "noauth/", "test");//AppSettings.SecurityToken);
}
}
}
93 changes: 93 additions & 0 deletions MyCompany.Visitors.Client.iOS/Extensions/ImageExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System;
using System.Drawing;
using System.Threading.Tasks;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreImage;
using MonoTouch.Foundation;
using MyCompany.Visitors.Client;

namespace MonoTouch.UIKit
{
static class ImageExtensions
{
static CIContext context;


public static UIImage ResizeImage(this UIImage theImage, float width, float height, bool keepRatio = true)
{
if (keepRatio)
{
var ratio = theImage.Size.Height / theImage.Size.Width;
if (height > width)
width = height * ratio;
else
height = width * ratio;
}

UIGraphics.BeginImageContext(new SizeF(width, height));
var c = UIGraphics.GetCurrentContext();

theImage.Draw(new RectangleF(0, 0, width, height));
var converted = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
return converted;
}

public static UIImage ToImage(this VisitorPicture picture)
{
return picture == null || picture.Content == null ? null : picture.Content.ToImage();
}
public static UIImage ToImage(this EmployeePicture picture)
{
return picture == null || picture.Content == null ? null : picture.Content.ToImage();
}


public static UIImage ToImage(this byte[] bytes)
{
if (bytes == null)
return null;

using (var data = NSData.FromArray(bytes))
{
return UIImage.LoadFromData(data);
}
}

public static Task<UIImage> BlurAsync(this UIImage image, float radius)
{
return Task.Factory.StartNew(() => image.Blur(radius));
}

public static UIImage Blur(this UIImage image, float radius)
{
try
{
var imageToBlur = CIImage.FromCGImage(image.CGImage);

var transform = new CIAffineClamp();
transform.Transform = CGAffineTransform.MakeIdentity();
transform.Image = imageToBlur;


var gaussianBlurFilter = new CIGaussianBlur();

gaussianBlurFilter.Image = transform.OutputImage;
gaussianBlurFilter.Radius = radius;
if (context == null)
context = CIContext.FromOptions(null);

var resultImage = gaussianBlurFilter.OutputImage;

var finalImage = UIImage.FromImage(
context.CreateCGImage(resultImage, new RectangleF(PointF.Empty, image.Size)), 1, UIImageOrientation.Up);
return finalImage;
}
catch (Exception ex)
{
Console.WriteLine(ex);
return image;
}
}
}
}
25 changes: 25 additions & 0 deletions MyCompany.Visitors.Client.iOS/Extensions/ViewExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using MonoTouch.Foundation;

namespace MonoTouch.UIKit
{
public static class ViewExtensions
{
public static UIView AddParallax(this UIView view, float min, float max)
{
return view;
view.AddMotionEffect(new UIInterpolatingMotionEffect("center.x",
UIInterpolatingMotionEffectType.TiltAlongHorizontalAxis)
{
MinimumRelativeValue = new NSNumber(min),
MaximumRelativeValue = new NSNumber(max)
});
view.AddMotionEffect(new UIInterpolatingMotionEffect("center.y",
UIInterpolatingMotionEffectType.TiltAlongVerticalAxis)
{
MinimumRelativeValue = new NSNumber(min),
MaximumRelativeValue = new NSNumber(max)
});
return view;
}
}
}
42 changes: 42 additions & 0 deletions MyCompany.Visitors.Client.iOS/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?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>UIDeviceFamily</key>
<array>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>7.0</string>
<key>CFBundleDisplayName</key>
<string>Visitors</string>
<key>CFBundleIdentifier</key>
<string>mycompanydemo.com.visitors</string>
<key>CFBundleVersion</key>
<string></string>
<key>NSMainNibFile</key>
<string></string>
<key>NSMainNibFile~ipad</key>
<string></string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleIconFiles</key>
<array>
<string>Icon-72</string>
<string>Icon-76</string>
<string>Icon-76@2x</string>
<string>Icon-Small</string>
<string>Icon-Small-40</string>
<string>Icon-Small-40@2x</string>
</array>
</dict>
</plist>
20 changes: 20 additions & 0 deletions MyCompany.Visitors.Client.iOS/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;

using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace MyCompany.Visitors.Client.iOS
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
}
}
}
Loading

0 comments on commit 370d702

Please sign in to comment.