void SetupPage()
        {
            AddTitleRow("Title");

            if (!ServiceNodeManager.Current.HadUnlockedServiceNode)
            {
                AddInfoRow("NotesPage.Info", Tr.Get("App.FullName"));

                ServiceNodesPage.AddAuthorizeSection(ServiceNodeManager.Current.NewDefaultServiceNode, this, false);
            }
            else
            {
                var editor = AddEditorRow("", "Text");
                editor.Edit.TextChanged += Edit_TextChanged;
                FocusElement             = editor.Edit;


                var submit = AddSubmitRow("Submit", Submit, true);
                submit.IsEnabled = false;

                AddHeaderRow("Common.SubmitAccount");
                _submitAccount = AddRow(new SubmitAccountButtonRow(NoteApp.Current.GetLastUsedSubmitAccount <SubmitAccount>(), this, SelectSubmitAccount));
                AddInfoRow("Common.SubmitAccountInfo");
                AddFooterRow();
            }
        }
Exemple #2
0
        Task InboxChanged(SubmitAccountButtonRow <MessageSubmitAccount> obj)
        {
            var submitAccount = obj.SubmitAccount;

            if (submitAccount == null)
            {
                return(Task.CompletedTask);
            }

            var info = obj.Tag as InboxNameRecordInfo;

            if (info == null)
            {
                return(Task.CompletedTask);
            }

            IsBusy = true;

            var index = MessageService.MessageServiceInfo.GetConversationIndex(submitAccount.AccountId, submitAccount.KeyIndex, submitAccount.FriendAccountId, submitAccount.FriendKeyIndex);
            var chat  = _node.GetChat(index, true);

            AddIndex       = GetRow("InboxInfo");
            AddIndexBefore = true;
            RemoveView(GetRow("SendMessage"));
            var b = AddButtonRow("SendMessage", SendMessage);

            b.SetDetailViewIcon(Icons.Pencil);
            b.Tag = chat;

            AddIndexBefore = false;

            IsBusy = false;
            return(Task.CompletedTask);
        }
Exemple #3
0
 async Task SelectSubmitAccount(SubmitAccountButtonRow <SubmitAccount> button)
 {
     await Navigation.PushAsync(new SubmitAccountsPage(ServiceNodeManager.Current.GetSubmitAccounts <SubmitAccount>(), (submitAccount) =>
     {
         _submitAccount.SubmitAccount = submitAccount;
         VerifyApp.Current.SetLastUsedSubmitAccount(submitAccount);
     }));
 }
        public AddTodoTaskPage(TodoList todoList) : base("AddTodoTaskPage")
        {
            Subscribe <NewTodoTaskEvent>(TodoTask);

            AddTitleRow("Title");

            AddHeaderRow("TodoList");

            var selectionList = new SelectionItemList <TodoList>();

            foreach (var serviceNode in ServiceNodeManager.Current.ServiceNodes)
            {
                var todo = TodoApp.Current.GetTodo(serviceNode);
                if (todo != null)
                {
                    foreach (var list in todo.TodoLists)
                    {
                        selectionList.Add(new SelectionItem <TodoList>(list, TodoApp.GetTodoListName(list)));
                    }
                }
            }

            _listSelection = AddSelectionRows(selectionList, todoList);
            _listSelection.SelectionChanged = SelectionChanged;

            Status.Add(T("ListStatus"), (sv) =>
            {
                return(_listSelection.Selection != null);
            });

            AddFooterRow();

            _editor = AddEditorRow("", "Text");
            _editor.SetDetailViewIcon(Icons.Pencil);

            FocusElement = _editor.Edit;

            Status.Add(_editor.Edit, T("TextStatus"), (sv, edit, newText, oldText) =>
            {
                return(!string.IsNullOrWhiteSpace(newText) && newText.Length >= 2);
            });


            AddSubmitRow("Submit", Submit);

            AddHeaderRow("Common.SubmitAccount");
            _submitAccount = AddRow(new SubmitAccountButtonRow <TodoListSubmitAccount>(null, this, SelectSubmitAccount));
            AddInfoRow("Common.SubmitAccountInfo");
            AddFooterRow();
            SelectionChanged(todoList);

            Status.Add(T("SubmitAccountStatus"), (sv) =>
            {
                return(_submitAccount.SubmitAccount != null);
            });
        }
        async Task SelectSubmitAccount(SubmitAccountButtonRow <GroupSubmitAccount> arg)
        {
            var todoList = _listSelection.Selection;

            if (todoList != null)
            {
                await Navigation.PushAsync(new SubmitAccountsPage <GroupSubmitAccount>(todoList.ServiceNode.GetSubmitAccounts <GroupSubmitAccount>(), (submitAccount) =>
                {
                    arg.SubmitAccount = submitAccount;
                    Status.ReValidate();
                }));
            }
        }
        async Task SelectSubmitAccount(SubmitAccountButtonRow <TodoListSubmitAccount> arg)
        {
            var todoList = _listSelection.Selection;

            if (todoList != null)
            {
                await Navigation.PushAsync(new SubmitAccountsPage <TodoListSubmitAccount>(todoList.ServiceNode.GetSubmitAccounts <TodoListSubmitAccount>(todoList.Index), (submitAccount) =>
                {
                    arg.SubmitAccount = submitAccount;
                    TodoApp.Current.SetLastUsedSubmitAccount(submitAccount, todoList.ListId.ToString());
                    Status.ReValidate();
                }));
            }
        }
        public NewTodoListPage() : base("NewTodoListPage")
        {
            Subscribe <TodoListRegistrationEvent>(TodoListRegistration);

            AddTitleRow("Title");

            AddInfoRow("TodoPage.Info", Tr.Get("App.FullName"));

            AddSubmitRow("Submit", NewTodoList);

            AddHeaderRow("Common.SubmitAccount");
            _submitAccount = AddRow(new SubmitAccountButtonRow(this, () => ServiceNodeManager.Current.GetSubmitAccounts <SubmitAccount>(TodoServiceInfo.TodoSubmitIndex)));
            AddInfoRow("Common.SubmitAccountInfo");
            AddFooterRow();
        }
Exemple #8
0
        public RequestInvitationPage() : base("RequestInvitationPage")
        {
            AddTitleRow("Title");


            AddHeaderRow("Request");

            _request = AddEditorRow(_uri, null);
            _request.Edit.IsReadOnly = true;

            _copy = AddButtonRow("Copy", Copy);
            _open = AddButtonRow("Open", Open);

            if (UIApp.CanShare)
            {
                _share          = AddButtonRow("Share", Share);
                _share.RowStyle = Theme.SubmitButton;
            }

            AddFooterRow();

            _id = new MonoSpaceLabel {
                FontSize = 20, HorizontalTextAlignment = Xamarin.Forms.TextAlignment.Center
            };
            AddViewRow(_id);

            AddTextRow("Info");

            AddFooterRow();

            AddHeaderRow("Common.SubmitAccount");
            _submitAccount = AddRow(new SubmitAccountButtonRow(this, () => ServiceNodeManager.Current.GetSubmitAccounts <SubmitAccount>(TodoServiceInfo.TodoSubmitIndex)));
            _submitAccount.SelectionChanged = (sa) => Update();
            AddInfoRow("Common.SubmitAccountInfo");
            AddFooterRow();


            Update();
        }
        public override async Task InitAsync()
        {
            if (!IsBusy)
            {
                return;
            }

            var name = TodoApp.GetTodoListName(null);

            var nameId = await Group.DownloadIndexLastTransactionInfo(_serviceNode.Client, Chain.ChainType.Data, _serviceNode.ChainId, TodoServiceInfo.TodoDataChainIndex, _invitation.ListId, TodoServiceInfo.TodoListNameIndex);

            if (nameId?.Item?.TransactionId != Operation.InvalidTransactionId)
            {
                var nameTransaction = (await _serviceNode.Client.DownloadDataTransactionItem(_serviceNode.ChainId, TodoServiceInfo.TodoDataChainIndex, nameId.Item.TransactionId)).Data?.Transaction;
                if (nameTransaction != null)
                {
                    var encryptedRecord = TodoList.GetEncrytpedTodoRedord <TodoListNameRecord>(nameTransaction);
                    var record          = await encryptedRecord.GetRecord(_invitation.SecretKey);

                    if (record != null)
                    {
                        name = record.Name;
                    }
                }
            }

            IsBusy = false;

            AddViewRow(new InvitationView(name, _invitation.SenderAccountId));
            AddButtonRow("Profile", Profile);

            AddSubmitRow("Submit", Submit);

            AddHeaderRow("Common.SubmitAccount");
            _submitAccount = AddRow(new SubmitAccountButtonRow(this, () => _serviceNode.GetSubmitAccounts <SubmitAccount>(TodoServiceInfo.TodoSubmitIndex)));
            AddInfoRow("Common.SubmitAccountInfo");
            AddFooterRow();
        }
Exemple #10
0
        public TodoListPage(TodoList todoList, bool edit) : base("TodoListPage")
        {
            Subscribe <QueryTodoListEvent>(QueryTodoList);

            if (edit)
            {
                Subscribe <TodoListNameChangedEvent>(ListName);
                Subscribe <TodoListDeletetEvent>(GroupDeleted);
            }

            TodoList = todoList;
            _edit    = edit;


            var header = AddTitleRow(null);

            header.Identifier = "Title";
            var title = TodoApp.GetTodoListName(todoList);

            header.Label.Text = title;
            SetTitle(title);

            UpdateSecretKeyButton();

            var items = todoList.GetTasks(TodoTaskStatusTypes.Open, TodoListSortMethod.ByTimestampDesc);

            AddHeaderRow("OpenTasks");

            if (items.Count > 0)
            {
                foreach (var item in items)
                {
                    var b = AddTaskButtonRow(item);
                    _openTasks.Add(b);
                }
            }
            else
            {
                AddInfoRow("NoOpenTasks");
            }

            AddFooterRow();

            if (!_edit)
            {
                AddHeaderRow("More");

                var button = AddButtonRow("TodoListView.Add", NewTask);
                //add.Margin = new Thickness(40, 0, 0, 0);
                button.RowStyle           = Theme.SubmitButton;
                button.FontIcon.IsVisible = false;
                button.SetDetailViewIcon(Icons.Plus);
                //add.IsEnabled = !todoList.HasMissingSecretKeys;

                button = AddButtonRow("Edit", Edit);
                button.SetDetailViewIcon(Icons.Pencil);

                button = AddButtonRow("Reload", Reload);
                button.SetDetailViewIcon(Icons.Sync);
                AddFooterRow();
            }

            if (_edit)
            {
                items = todoList.GetTasks(TodoTaskStatusTypes.Closed, TodoListSortMethod.ByTimestampDesc);

                AddHeaderRow("ClosedTasks");
                if (items.Count > 0)
                {
                    foreach (var item in items)
                    {
                        var b = AddTaskButtonRow(item);
                        _closedTasks.Add(b);
                    }
                }
                else
                {
                    AddInfoRow("NoClosedTasks");
                }
                AddFooterRow();

                AddHeaderRow("UsersSection");

                var button = AddButtonRow("ViewUsers", Users);
                button.SetDetailViewIcon(Icons.Users);
                button = AddButtonRow("Invite", Invite);
                button.SetDetailViewIcon(Icons.UserPlus);

                AddFooterRow();

                AddHeaderRow("NameHeader");

                _nameEntry = AddEntryRow(todoList.Name, "Name");
                _nameEntry.SetDetailViewIcon(Icons.Pencil);
                _nameButton          = AddSubmitButtonRow("NameButton", Name);
                _nameButton.RowStyle = Theme.SubmitButton;

                Status.AddBusyView(_nameEntry.Edit);
                Status.AddBusyView(_nameButton);
                AddFooterRow();

                AddHeaderRow("Common.SubmitAccount");
                _submitAccount = AddRow(new SubmitAccountButtonRow <GroupSubmitAccount>(this, () => todoList.ServiceNode.GetSubmitAccounts <GroupSubmitAccount>(todoList.Index), todoList.ListId.ToString()));
                AddInfoRow("Common.SubmitAccountInfo");
                AddFooterRow();

                AddHeaderRow("DeleteHeader");

                var del = AddButtonRow("DeleteButton", Delete);
                del.RowStyle = Theme.CancelButton;
                del.SetDetailViewIcon(Icons.TrashAlt);

                Status.AddBusyView(del);

                AddFooterRow();
            }
        }
        public InvitationPage(ServiceNode serviceNode, long todoListId, long accountId = 0) : base("InvitationPage")
        {
            Subscribe <TodoListInvitationSentEvent>(InvitationResult);

            EnableStatus();

            AddTitleRow("Title");

            var todo = TodoApp.Current.GetTodo(serviceNode);

            if (todo.TodoLists.Count == 0)
            {
                AddInfoRow("NoLists");
                return;
            }

            AddHeaderRow("List");

            TodoList @default      = null;
            var      listSelection = new SelectionItemList <TodoList>();

            foreach (var list in todo.TodoLists)
            {
                listSelection.Add(new SelectionItem <TodoList>(list, TodoApp.GetTodoListName(list)));
                if (list.ListId == todoListId)
                {
                    @default = list;
                }
            }

            _listSelection = AddSelectionRows(listSelection, @default);
            _listSelection.SelectionChanged = SelectionChanged;

            Status.Add(T("ListStatus"), (sv) => {
                return(_listSelection.Selection != null);
            });

            AddFooterRow();

            AddHeaderRow("AccountId");

            _accountId = AddEntryRow(accountId > 0 ? accountId.ToString() : null, "AccountId");
            Status.Add(_accountId.Edit, T("AccountStatus"), (sv, edit, n, o) =>
            {
                var valid = StatusValidators.PositiveNumberValidator(sv, edit, n, o);
                if (_profile != null)
                {
                    _profile.IsEnabled = valid;
                    if (valid)
                    {
                        _profile.AccountId = long.Parse(n);
                    }
                    else
                    {
                        _profile.AccountId = 0;
                    }
                }
                return(valid);
            });

            _profile           = AddRow(new ProfileButtonRow(0, Profile));
            _profile.IsEnabled = accountId > 0;
            Status.AddBusyView(_profile);

            AddFooterRow();

            AddIndex       = AddSubmitRow("Submit", Submit);
            AddIndexBefore = true;

            _password = AddPasswordRow("", "Password");
            Status.Add(_password.Edit, T("PasswordStatus"), (sv, edit, newtext, oldtext) => true);

            AddIndex       = null;
            AddIndexBefore = false;

            AddHeaderRow("Common.SubmitAccount");
            _submitAccount = AddRow(new SubmitAccountButtonRow <GroupSubmitAccount>(null, this, SelectSubmitAccount));
            AddInfoRow("Common.SubmitAccountInfo");
            AddFooterRow();

            Status.Add(T("SubmitAccountStatus"), (sv) =>
            {
                return(_submitAccount.SubmitAccount != null);
            });

            SelectionChanged(@default);
        }
Exemple #12
0
        public TodoTaskPage(TodoList todoList, TodoTask task) : base("TodoTaskPage")
        {
            Subscribe <NewTodoTaskEvent>(TodoItem);
            Subscribe <TodoTaskStatusEvent>(TodoItemStatus);

            _todoList = todoList;
            _task     = task;

            AddTitleRow("Title");

            AddHeaderRow("StatusHeader");

            var statusItems = new SelectionItemList <TodoTaskStatusTypes>
            {
                new SelectionItem <TodoTaskStatusTypes>(TodoTaskStatusTypes.Open, Tr.Get("ItemStatusTypes.Open")),
                new SelectionItem <TodoTaskStatusTypes>(TodoTaskStatusTypes.Closed, Tr.Get("ItemStatusTypes.Closed"))
            };

            _status = AddSelectionRows(statusItems, task.Status);
            _status.SelectionChanged = StatusChanged;

            _statusButton           = AddSubmitButtonRow("SubmitStatus", StatusButton);
            _statusButton.RowStyle  = Theme.SubmitButton;
            _statusButton.IsEnabled = false;

            _status.Buttons[0].SetDetailViewIcon(Icons.Circle);
            _status.Buttons[1].SetDetailViewIcon(Icons.CircleCheck);

            foreach (var b in _status.Buttons)
            {
                Status.AddBusyView(b);
            }
            Status.AddBusyView(_statusButton);

            AddFooterRow();

            if (task.Status == TodoTaskStatusTypes.Open)
            {
                AddHeaderRow("ItemHeader");

                _text = AddEditorRow(task.Text, "Text");
                _text.SetDetailViewIcon(Icons.Pencil);
                _text.Edit.TextChanged += Edit_TextChanged;

                _textButton           = AddSubmitButtonRow("SubmitText", Submit);
                _textButton.RowStyle  = Theme.SubmitButton;
                _textButton.IsEnabled = false;

                Status.AddBusyView(_text.Edit);
                Status.AddBusyView(_textButton);

                AddFooterRow();
            }

            _history = AddHeaderRow("HistoryHeader");
            AddFooterRow();

            _transactionInfo = AddHeaderRow("TransactionInfo");
            AddFooterRow();

            AddHeaderRow("Common.SubmitAccount");
            _submitAccount = AddRow(new SubmitAccountButtonRow <GroupSubmitAccount>(this, () => todoList.ServiceNode.GetSubmitAccounts <GroupSubmitAccount>(todoList.Index), todoList.ListId.ToString()));
            AddInfoRow("Common.SubmitAccountInfo");
            AddFooterRow();

            AddHeaderRow("DeleteHeader");

            var delete = AddButtonRow("SubmitDelete", Delete);

            delete.RowStyle = Theme.CancelButton;
            delete.SetDetailViewIcon(Icons.TrashAlt);

            Status.AddBusyView(delete);

            AddFooterRow();

            _ = BuildHistory();
        }
Exemple #13
0
        void SetupPage()
        {
            StackLayout.Children.Clear();

            if (!ServiceNodeManager.Current.HadUnlockedServiceNode)
            {
                AddTitleRow("VerifyPage.Title");

                AddInfoRow("VerifyInfo");

                ServiceNodesPage.AddAuthorizeSection(ServiceNodeManager.Current.NewDefaultServiceNode, this, false);
            }
            else
            {
                AddTitleRow("Title");
                AddHeaderRow("Info");

                _description = AddEntryRow(null, "Description");
                _description.SetDetailViewIcon(Icons.Pencil);
                _link = AddEntryRow(null, "Link");
                _link.SetDetailViewIcon(Icons.RowLink);

                Status.Add(_description.Edit, T("DescriptionStatus"), (view, entry, newText, oldTex) =>
                {
                    if (string.IsNullOrEmpty(newText))
                    {
                        return(false);
                    }

                    return(true);
                }).
                Add(_link.Edit, T("LinkStatus"), (view, entry, newText, oldText) =>
                {
                    if (string.IsNullOrEmpty(newText))
                    {
                        return(true);
                    }

                    return(newText.IsValdiUrl(true));
                });

                AddFooterRow();

                AddHeaderRow("Files");

                _addButton = AddButtonRow("AddFile", AddFile);

                Status.Add(T("FilesStatus"), (sv) =>
                {
                    return(GetVerifyFiles().Count > 0);
                });

                AddFooterRow();

                AddSubmitRow("Submit", Submit);

                AddHeaderRow("Common.SubmitAccount");
                _submitAccount = AddRow(new SubmitAccountButtonRow(VerifyApp.Current.GetLastUsedSubmitAccount <SubmitAccount>(), this, SelectSubmitAccount));
                AddInfoRow("Common.SubmitAccountInfo");
                AddFooterRow();
            }
        }