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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using MonoTouch.UIKit; | |
namespace Async.iOS | |
{ | |
public static class Layout | |
{ |
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
public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) | |
{ | |
this.HasOptionsMenu = true; | |
var ignored = base.OnCreateView(inflater, container, savedInstanceState); | |
var view = this.BindingInflate(Resource.Layout.TimerView, null); | |
var leftButton = view.FindViewById<Button>(Resource.Id.LeftButton); | |
leftButton.Text = "\U000025C0\U0000FE0E"; | |
var rightButton = view.FindViewById<Button>(Resource.Id.RightButton); | |
rightButton.Text = "\U000025B6\U0000FE0E"; |
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
06-09 11:36:16.740 I/MonoDroid(21351): UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object | |
06-09 11:36:16.740 I/MonoDroid(21351): at V.JobTrak.Apps.Droid.Views.EnterTimeView.OnCreateView (Android.Views.LayoutInflater,Android.Views.ViewGroup,Android.OS.Bundle) <IL 0x000cf, 0x00588> | |
06-09 11:36:16.740 I/MonoDroid(21351): at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (intptr,intptr,intptr,intptr,intptr) <IL 0x00026, 0x0019f> | |
06-09 11:36:16.740 I/MonoDroid(21351): at (wrapper dynamic-method) object.d4c53d5a-8a99-43f6-bd55-88a30287aec2 (intptr,intptr,intptr,intptr,intptr) <IL 0x00023, 0x0005f> | |
An unhandled exception occured. | |
Unhandled Exception: | |
Java.Lang.Throwable: Loading... |
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
From public abstract class MvxEventSourceFragmentActivity | |
1. OnCreate | |
2. StartActivityForResult | |
3. OnStart | |
4. OnResume | |
5. OnPause | |
6. OnSaveInstanceState | |
7. OnStop | |
8. OnDestroy |
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
private void UIElement_OnTap(object sender, GestureEventArgs e) | |
{ | |
var selectedItem = ((HomeViewModel) ViewModel).MenuItems.FirstOrDefault(x => x.Title == ((TextBlock)sender).Text); | |
if(null != selectedItem) | |
((HomeViewModel)ViewModel).SelectMenuItemCommand.Execute(selectedItem); | |
} |
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
/// <summary> | |
/// Creates the app. | |
/// </summary> | |
/// <returns>An instance of IMvxApplication.</returns> | |
protected override IMvxApplication CreateApp() | |
{ | |
var connectionParameters = new SQLiteConnectionString(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "database.db"), false); | |
var sqliteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformAndroid()); | |
var connection = new SQLiteAsyncConnection(() => sqliteConnectionPool.GetConnection(connectionParameters)); | |
Mvx.RegisterSingleton<SQLiteAsyncConnection>(connection); |
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
Func<object, DataPoint> dataPointMapping; | |
if (weightRepository.Units == WeightRepository.LBS) | |
dataPointMapping = item => new DataPoint (DateTimeAxis.ToDouble (((WeightEntry)item).Date), ((WeightEntry)item).WeightLbs); | |
else | |
dataPointMapping = item => new DataPoint (DateTimeAxis.ToDouble (((WeightEntry)item).Date), ((WeightEntry)item).WeightKg); | |
weightLinePlot.Mapping = dataPointMapping; |
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
Root = new RootElement("Settings") | |
{ | |
new Section ("") { | |
(Element)new RootElement ("Units", new RadioGroup (Settings.UnitsInches ? 0 : 1)) { | |
new Section ("Select Units for Measurements") { | |
new RadioElement ("Inches"), | |
new RadioElement ("Centimeters"), | |
}, | |
}.Bind(bindings, e => e.RadioSelected, vm => vm.UnitsIndex) as Element, |
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
Action work = () =>Console.Writeln("work!"); | |
Scheduler.Default.Schedule( | |
// start in so many seconds | |
TimeSpan.FromSeconds(60 - DateTime.Now.Second), | |
// then run every minute | |
() => Scheduler.Default.SchedulePeriodic(TimeSpan.FromMinutes(1), work)); |
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
//reactive extensions for scroll view | |
IEventPatternSource<EventArgs> ScrollReactSource; | |
/// <summary> | |
/// Occurs when react on decelerate. Contrived method to make working with the even easier | |
/// </summary> | |
public event EventHandler<EventArgs> ReactOnDecelerate | |
{ | |
add { ScrollReactSource.OnNext += value; } | |
remove { ScrollReactSource.OnNext -= value; } |
OlderNewer