public async override void OnCreate (Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            viewModel = new ClientListViewModel (WorkspaceId);
            await viewModel.Init ();
        }
        public override void OnDestroy ()
        {
            if (viewModel != null) {
                viewModel.OnIsLoadingChanged -= OnModelLoaded;
                viewModel.ClientListDataView.Updated -= OnWorkspaceClientsUpdated;
                viewModel.Dispose ();
                viewModel = null;
            }

            base.OnDestroy ();
        }
        public async override void OnCreate (Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            if (viewModel == null) {
                viewModel = new ClientListViewModel (workspaceId, model);
            }
            await viewModel.Init ();

            if (viewModel.Model.Workspace == null || viewModel.Model.Workspace.Id == Guid.Empty) {
                Dismiss ();
            }
        }
Exemplo n.º 4
0
        public static async Task<ClientListViewModel> Init (Guid workspaceId)
        {
            var vm = new ClientListViewModel ();
            vm.ClientDataCollection = new ObservableRangeCollection<ClientData> ();

            var store = ServiceContainer.Resolve<IDataStore> ();
            var clients = await store.Table<ClientData> ()
                          .Where (r => r.DeletedAt == null && r.WorkspaceId == workspaceId)
                          .ToListAsync();

            if (clients.Count == 0) {
                clients.Add (new ClientData { Name = "No client" });
            }

            vm.Sort (clients);
            vm.ClientDataCollection.AddRange (clients);
            return vm;
        }
Exemplo n.º 5
0
        public static async Task <ClientListViewModel> Init(Guid workspaceId)
        {
            var vm = new ClientListViewModel();

            vm.ClientDataCollection = new ObservableRangeCollection <ClientData> ();

            var store   = ServiceContainer.Resolve <IDataStore> ();
            var clients = await store.Table <ClientData> ()
                          .Where(r => r.DeletedAt == null && r.WorkspaceId == workspaceId)
                          .ToListAsync();

            if (clients.Count == 0)
            {
                clients.Add(new ClientData {
                    Name = "No client"
                });
            }

            vm.Sort(clients);
            vm.ClientDataCollection.AddRange(clients);
            return(vm);
        }
 public override void OnDestroy ()
 {
     viewModel.Dispose ();
     viewModel = null;
     base.OnDestroy ();
 }
 public async override void OnCreate (Bundle savedInstanceState)
 {
     base.OnCreate (savedInstanceState);
     viewModel = await ClientListViewModel.Init (WorkspaceId);
     SetDialogContent ();
 }
 public ClientListFragment (Guid workspaceId, ProjectModel project)
 {
     this.workspaceId = workspaceId;
     this.model = project;
     viewModel = new ClientListViewModel (this.workspaceId, model);
 }