Last active
August 29, 2015 14:04
-
-
Save DevJohnC/424b5e0bdeb5cc022829 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.Linq; | |
using Xamarin.Forms; | |
using AdjutantFramework; | |
using AdjutantFramework.Network; | |
namespace Client | |
{ | |
public class ComputerList : ContentPage | |
{ | |
public ComputerList () | |
{ | |
Padding = new Thickness (10); | |
var listView = new ListView(); | |
var source = Framework.Bundle.DeviceRepository.NetworkNodes.ToArray (); | |
var deviceModels = new ViewModel.NetworkDevice[source.Length]; | |
for (var i = 0; i < source.Length; i++) { | |
deviceModels [i] = new ViewModel.NetworkDevice | |
{ | |
Node = source[i] | |
}; | |
} | |
listView.ItemsSource = deviceModels; | |
listView.ItemTemplate = new DataTemplate(typeof(ViewModel.NetworkDevice)); | |
listView.ItemTemplate.SetBinding (TextCell.TextProperty, "Name"); | |
Content = listView; | |
} | |
} | |
} |
This file contains hidden or 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
System.Diagnostics.Debugger.Mono_UnhandledException (ex={System.InvalidCastException: Cannot cast from source type to destination type. | |
at (wrapper castclass) object.__castclass_with_cache (object,intptr,intptr) <IL 0x0002c, 0x00080> | |
at Xamarin.Forms.TemplatedItemsList`2<Xamarin.Forms.ItemsView`1<Xamarin.Forms.Cell>, Xamarin.Forms.Cell>.CreateContent (int,object,bool) <0x0018b> | |
at Xamarin.Forms.TemplatedItemsList`2<Xamarin.Forms.ItemsView`1<Xamarin.Forms.Cell>, Xamarin.Forms.Cell>.GetOrCreateContent (int,object) <0x00107> | |
at Xamarin.Forms.TemplatedItemsList`2/<GetEnumerator>d__0<Xamarin.Forms.ItemsView`1<Xamarin.Forms.Cell>, Xamarin.Forms.Cell>.MoveNext () <0x002cf> | |
at System.Linq.Enumerable/<CreateSkipIterator>c__Iterator16`1<Xamarin.Forms.Cell>.MoveNext () <0x0046b> | |
at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellsFromPosition (int,int) <IL 0x00056, 0x0036f> | |
at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellForPosition (int) <IL 0x00003, 0x0004f> | |
at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (int,Android.Views.View,Android.Views.ViewGroup) <IL 0x00046, 0x002cb> | |
at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (intptr,intptr,int,intptr,intptr) [0x0001a] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.14-series/a5d57087/source/monodroid/src/Mono.Android/platforms/android-14/src/generated/Android.Widget.BaseAdapter.cs:460 | |
at (wrapper dynamic-method) object.6694c7b1-1460-4597-bb5a-288886985ace (intptr,intptr,int,intptr,intptr) <IL 0x00023, 0x0005f> | |
}) in |
This file contains hidden or 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 AdjutantFramework.Network; | |
namespace Client.ViewModel | |
{ | |
public class NetworkDevice | |
{ | |
public INetworkNode Node { get; set; } | |
public string Name | |
{ | |
get | |
{ | |
return Node.DeviceName; | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment