Skip to content

Instantly share code, notes, and snippets.

View nicwise's full-sized avatar
🙀
Screaming At Clouds

Nic Wise nicwise

🙀
Screaming At Clouds
View GitHub Profile
public partial class AppDelegate : UIApplicationDelegate
{
public SummaryDialogViewController Summary2;
public EntryDialogViewController EntryDVC;
public SettingsDialogViewController SettingsDVC;
public UITabBarController tabBar;
public UIView MainView;
public UIViewController[] tabControllers;
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
namespace TravelBudget
{
//BaseDialogViewController just inherits off DialogViewController
@nicwise
nicwise / gist:1411364
Created November 30, 2011 22:21
BackgroundStringElement
// copied from StyledStringElement, I think.
// mostly just gets the cell, puts a background on it (which also gets rid of the default
// rounded corners etc) and sets the colours on the _existing_ cell.TextLabel and cell.DetailTextLabel
public class BackgroundStringElement : StyledStringElement, IElementSizing
{
//if you make a new element, you NEED to put in a unique identifier, and use it in the DequeueReusableCell.
static NSString skey = new NSString("BackgroundStringElement");
@nicwise
nicwise / gist:1411468
Created November 30, 2011 22:35
InvoiceElement
public class InvoiceElement : StyledStringElement, IElementSizing
{
private Contact contact;
private Invoice invoice;
static NSString skey = new NSString("InvoiceElement");
public InvoiceElement(Invoice invoice, Contact contact, NSAction ontapped) : base("", ontapped)
{
this.contact = contact;
@nicwise
nicwise / gist:1431457
Created December 4, 2011 22:13
threading stuff
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
Task.Factory.StartNew(() => {
Console.WriteLine ("ping");
Thread.Sleep(4000);
Console.WriteLine ("pong");
return "from the thread";
@nicwise
nicwise / gist:1510675
Created December 22, 2011 15:24
CSS parsing
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using System.Web;
using System.Web.Caching;
@nicwise
nicwise / gist:1705400
Created January 30, 2012 16:54
Right aligned entry box
public class BTDateElement : EntryElement
{
public bool minDateSet = false;
public bool maxDateSet = false;
private DateTime _minDate, _maxDate;
public DateTime MinDate
{
get { return _minDate; }
set { _minDate = value; minDateSet = true; }
}
public class EditingSource : DialogViewController.Source
{
RecordsDialogViewController tvc = null;
public EditingSource(RecordsDialogViewController dvc) : base(dvc)
{
tvc = dvc;
}
public override bool CanEditRow (UITableView tableView, NSIndexPath indexPath)
//most of the non-declared variables here are at the class level - eg window is:
// UIWindow window
// etc.
window = new UIWindow (UIScreen.MainScreen.Bounds);
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.BlackOpaque;
public class BTPinchGestureRecognizer : UIPinchGestureRecognizer
{
public BTPinchGestureRecognizer(NSObject target, Selector action) : base(target, action)
{
ShouldReceiveTouch += (sender, touch) => {
//if (touch.View is UISlider || touch.View is MPVolumeView) return false;
return true;
};