예제 #1
0
        //添加新条目,如果没有相同网站和相同账号,添加之,并保存,并显示列表。
        public async void AddData()
        {
            if (string.IsNullOrEmpty(RecordItemToModify.WebSite))
            {
                RecordItemToModify.WebSite = "错误!网站名称不能为空";
                return;
            }
            int index = RecordList.FindIndex(r => r.WebSite == RecordItemToModify.WebSite && r.Account == RecordItemToModify.Account);

            if (index > -1)
            {
                RecordItemToModify.WebSite = "错误!已存在当前网站";
                RecordItemToModify.Account = "错误!已存在当前账户";
            }
            else
            {
                RecordItem r = new RecordItem();
                CopyRecordItem(RecordItemToModify, r);
                RecordList.Add(r);
                string titleStr = await BackupAsync(SaveType.LocalState);

                if (titleStr.StartsWith("-"))
                {
                    Title = titleStr.Substring(1);
                }
                else
                {
                    Title = "收藏列表";
                }
                IsUcItemDetailVisible = false;
                IsGrdPwdsListVisible  = true;
                IsBackVisible         = false;
                IsListVisible         = true;
            }
        }
예제 #2
0
        //删除条目,
        public async void DeleteData(RecordItem recordItem)
        {
            int index = RecordList.FindIndex(r => r.WebSite == recordItem.WebSite && r.Account == recordItem.Account);

            RecordList.RemoveAt(index);
            await BackupAsync(SaveType.LocalState);
        }
예제 #3
0
        //更改数据,找到与记忆条目相同的,更改之,然后返回去
        public async void ModifyData()
        {
            if ((RecordItemMemory.WebSite == RecordItemToModify.WebSite && RecordItemMemory.Account == RecordItemToModify.Account) ||
                (RecordList.FindIndex(r => r.WebSite == RecordItemToModify.WebSite && r.Account == RecordItemToModify.Account) < 0))
            {
                int index = RecordList.FindIndex(r => r.WebSite == RecordItemMemory.WebSite && r.Account == RecordItemMemory.Account);
                CopyRecordItem(RecordItemToModify, RecordList[index]);
                string str = await BackupAsync(SaveType.LocalState);

                if (str.StartsWith("-"))
                {
                    Title = str.Substring(1);
                }
                else
                {
                    Title = "收藏列表";
                }
                IsUcItemDetailVisible = false;
                IsGrdPwdsListVisible  = true;
                IsBackVisible         = false;
            }
            else
            {
                RecordItemToModify.WebSite = "错误!已有此网站与账号!";
            }
        }