// This method is invoked when the application has loaded its UI and its ready to run public override bool FinishedLaunching(UIApplication app, NSDictionary options) { load(); string[] s; mainMenu = new Section("Blogs", "Click for a new Account"); for(int i = 0; i < titles.Count; i++){ s = titles.ElementAt(i); var a = new Account( s[0], s[1], s[2] ); accounts.Add( a ); a.SetDelegate(this); mainMenu.Add( a.GetRoot() ); } var nb = new StringElement("new Account", NewBlog); nb.Alignment = UITextAlignment.Center; mainMenu.Add( nb ); var dv = new ExtDialogViewController ( new RootElement("Blogs"){ mainMenu } ) { Autorotate = true, DisableUpsideDown = true }; window.AddSubview (navigation.View); navigation.PushViewController (dv, true); window.MakeKeyAndVisible (); return true; }
public void Changed( Account a ) { string[] s = titles.ElementAt( accounts.IndexOf( a ) ); if( s[0] != a.Name || s[1] != a.URL || s[2] != a.Login){ s[0] = a.Name; s[1] = a.URL; s[2] = a.Login; save(); } else Console.WriteLine( "no changes" ); }
public void Delete( Account a ) { Console.WriteLine( "Deleting: " + a.Name + a.URL + a.Login ); titles.RemoveAt( accounts.IndexOf( a ) ); mainMenu.Remove( accounts.IndexOf( a ) ); accounts.Remove(a); navigation.PopViewControllerAnimated(true); save(); }
public void NewBlog() { var a = new Account(); accounts.Add( a ); var s = new string[]{ a.Name, a.URL, a.Login }; titles.Add(s); a.SetDelegate(this); mainMenu.Insert( mainMenu.Count-1, a.GetRoot() ); navigation.PushViewController ( a.getDVC(null), true); }