Manager classes are an abstraction on the data access layers
        public TodoList()
        {
            InitializeComponent();

            manager = new TodoItemManager();

            // OnPlatform<T> doesn't currently support the "Windows" target platform, so we have this check here.
            if (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone)
            {
                syncButton.IsVisible = true;
            }
        }
Esempio n. 2
0
        public TodoList()
        {
            InitializeComponent();

            manager = new TodoItemManager();

            // OnPlatform<T> doesn't currently support the "Windows" target platform, so we have this check here.
            if (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone)
            {
                syncButton.IsVisible = true;
            }
        }
        public TodoItemViewModel(TodoItem todoItem, TodoItemManager itemManager)
        {
            if (todoItem == null)
            {
                throw new ArgumentNullException("todoItem");
            }

            if (itemManager == null)
            {
                throw new ArgumentNullException("itemManager");
            }

            this.todoItem = todoItem;
            this.itemManager = itemManager;

            InitializeImages(todoItem);
            InitializeCommands();
        }
Esempio n. 4
0
        public TodoItemViewModel(TodoItem todoItem, TodoItemManager itemManager)
        {
            if (todoItem == null)
            {
                throw new ArgumentNullException("todoItem");
            }

            if (itemManager == null)
            {
                throw new ArgumentNullException("itemManager");
            }

            this.todoItem    = todoItem;
            this.itemManager = itemManager;

            InitializeImages(todoItem);
            InitializeCommands();
        }
        public static async Task<TodoItemManager> CreateAsync()
        {
            var result = new TodoItemManager();
            result.client = new MobileServiceClient(Constants.ApplicationURL);

            var store = new MobileServiceSQLiteStore("localstore.db");
            store.DefineTable<TodoItem>();

            // Initialize file sync
            result.client.InitializeFileSyncContext(new TodoItemFileSyncHandler(result), store);

            // Initialize the SyncContext using the default IMobileServiceSyncHandler
            await result.client.SyncContext.InitializeAsync(store, StoreTrackingOptions.NotifyLocalAndServerOperations);

            result.todoTable = result.client.GetSyncTable<TodoItem>();


            return result;
        }
        public static async Task<TodoItemViewModel> CreateAsync(TodoItem todoItem, TodoItemManager itemManager)
        {
            if (todoItem == null) {
                throw new ArgumentNullException("todoItem");
            }

            if (itemManager == null) {
                throw new ArgumentNullException("itemManager");
            }

            TodoItemViewModel result = new TodoItemViewModel();

            result.todoItem = todoItem;
            result.itemManager = itemManager;

			await result.LoadImagesAsync();
            result.InitializeCommands();

            return result;
        }
        public static async Task <TodoItemManager> CreateAsync()
        {
            var result = new TodoItemManager();

            result.client = new MobileServiceClient(Constants.ApplicationURL);

            //var store = new MobileServiceSQLiteStore("localstore2.db" + DateTime.UtcNow.Ticks);
            var store = new MobileServiceSQLiteStore("localstore.db");

            store.DefineTable <TodoItem>();

            // Initialize file sync
            result.client.InitializeFileSyncContext(new TodoItemFileSyncHandler(result), store);

            // Initialize the SyncContext using the default IMobileServiceSyncHandler
            await result.client.SyncContext.InitializeAsync(store, StoreTrackingOptions.NotifyLocalAndServerOperations);

            result.todoTable = result.client.GetSyncTable <TodoItem>();


            return(result);
        }
Esempio n. 8
0
        public static async Task <TodoItemViewModel> CreateAsync(TodoItem todoItem, TodoItemManager itemManager)
        {
            if (todoItem == null)
            {
                throw new ArgumentNullException("todoItem");
            }

            if (itemManager == null)
            {
                throw new ArgumentNullException("itemManager");
            }

            TodoItemViewModel result = new TodoItemViewModel();

            result.todoItem    = todoItem;
            result.itemManager = itemManager;

            await result.LoadImagesAsync();

            result.InitializeCommands();

            return(result);
        }
Esempio n. 9
0
 public TodoItemFileSyncHandler(TodoItemManager itemManager)
 {
     this.todoItemManager = itemManager;
 }
 public TodoItemFileSyncHandler(TodoItemManager itemManager)
 {
     this.todoItemManager = itemManager;
 }