Example #1
0
        public async void Init()
        {
            IsLoading = true;

            // Create list manager.
            tagList = new WorkspaceTagsView(workspaceId);

            // Create model.
            if (timeEntryList.Count > 1)
            {
                Model = new TimeEntryGroup(timeEntryList);
            }
            else if (timeEntryList.Count == 1)
            {
                Model = new TimeEntryModel(timeEntryList [0]);
            }

            // Create tag list.
            var dataStore = ServiceContainer.Resolve <IDataStore> ();

            modelTags = new List <TimeEntryTagData> ();

            foreach (var timeEntryData in timeEntryList)
            {
                var tags = await dataStore.Table <TimeEntryTagData> ()
                           .QueryAsync(r => r.TimeEntryId == timeEntryData.Id && r.DeletedAt == null);

                modelTags.AddRange(tags);
            }

            Model.PropertyChanged += OnModelPropertyChanged;
            IsLoading              = false;
        }
        public override void OnCreate (Bundle state)
        {
            base.OnCreate (state);

            model = new TimeEntryModel (TimeEntryId);
            model.PropertyChanged += OnModelPropertyChanged;

            workspaceTagsView = new WorkspaceTagsView (WorkspaceId);
            workspaceTagsView.Updated += OnWorkspaceTagsUpdated;

            LoadModel ();
            LoadTags ();
        }
        public override void OnCreate(Bundle state)
        {
            base.OnCreate(state);

            model = new TimeEntryModel(TimeEntryId);
            model.PropertyChanged += OnModelPropertyChanged;

            workspaceTagsView          = new WorkspaceTagsView(WorkspaceId);
            workspaceTagsView.Updated += OnWorkspaceTagsUpdated;

            LoadModel();
            LoadTags();
        }
        public override void OnDestroy ()
        {
            if (model != null) {
                model.PropertyChanged -= OnModelPropertyChanged;
                model = null;
            }
            if (workspaceTagsView != null) {
                workspaceTagsView.Updated -= OnWorkspaceTagsUpdated;
                workspaceTagsView.Dispose ();
                workspaceTagsView = null;
            }

            base.OnDestroy ();
        }
        public override void OnDestroy()
        {
            if (model != null)
            {
                model.PropertyChanged -= OnModelPropertyChanged;
                model = null;
            }
            if (workspaceTagsView != null)
            {
                workspaceTagsView.Updated -= OnWorkspaceTagsUpdated;
                workspaceTagsView.Dispose();
                workspaceTagsView = null;
            }

            base.OnDestroy();
        }
        public override Dialog OnCreateDialog(Bundle state)
        {
            modelsView = new WorkspaceTagsView(WorkspaceId);

            var dia = new AlertDialog.Builder(Activity)
                      .SetTitle(Resource.String.ChooseTimeEntryTagsDialogTitle)
                      .SetAdapter(new TagsAdapter(modelsView), (IDialogInterfaceOnClickListener)null)
                      .SetNegativeButton(Resource.String.ChooseTimeEntryTagsDialogCancel, OnCancelButtonClicked)
                      .SetPositiveButton(Resource.String.ChooseTimeEntryTagsDialogOk, OnOkButtonClicked)
                      .Create();

            listView = dia.ListView;
            listView.ItemsCanFocus = false;
            listView.ChoiceMode    = ChoiceMode.Multiple;
            // Reset the item click listener such that the dialog wouldn't be closed on selecting a tag
            listView.OnItemClickListener = null;

            return(dia);
        }
        public override Dialog OnCreateDialog (Bundle state)
        {
            modelsView = new WorkspaceTagsView (WorkspaceId);

            var dia = new AlertDialog.Builder (Activity)
                .SetTitle (Resource.String.ChooseTimeEntryTagsDialogTitle)
                .SetAdapter (new TagsAdapter (modelsView), (IDialogInterfaceOnClickListener)null)
                .SetNegativeButton (Resource.String.ChooseTimeEntryTagsDialogCancel, OnCancelButtonClicked)
                .SetPositiveButton (Resource.String.ChooseTimeEntryTagsDialogOk, OnOkButtonClicked)
                .Create ();

            listView = dia.ListView;
            listView.ItemsCanFocus = false;
            listView.ChoiceMode = ChoiceMode.Multiple;
            // Reset the item click listener such that the dialog wouldn't be closed on selecting a tag
            listView.OnItemClickListener = null;

            return dia;
        }
Example #8
0
 public void Dispose()
 {
     model.PropertyChanged -= OnModelPropertyChanged;
     tagList.Dispose();
     tagList = null;
 }