Пример #1
0
        private async void EditHosting()
        {
            if (tree.SelectedNode == null)
            {
                return;
            }

            var current = (Node <OAuthCredentials>)tree.SelectedNode.Tag;

            if (current.Value.Service == null || services.IsContainsManager(current.Value.Service))
            {
                var credentials = await OAuthCredentialsEditor.ShowNew(current.Value, services.Managers.ToArray());

                if (credentials.HasBeenCanceled)
                {
                    return;
                }
                current.Value = credentials;
                UpdateNode(tree.SelectedNode);
            }
        }
Пример #2
0
        private async void NewHosting()
        {
            var curent = tree.SelectedNode;
            var node   = ((Node <OAuthCredentials>)tree.SelectedNode?.Tag);

            if (curent == null)
            {
                var credentials = await OAuthCredentialsEditor.ShowNew(services.Managers.ToArray());

                if (credentials.HasBeenCanceled)
                {
                    return;
                }
                result.Value = new Node <OAuthCredentials>(credentials);
                Update();
            }
            else if (node?.Value.Service != null)
            {
                if (services.IsContainsMultiHostingManager(node.Value.Service))
                {
                    var credentials = await OAuthCredentialsEditor.ShowNew(services.Managers.ToArray());

                    if (credentials.HasBeenCanceled)
                    {
                        return;
                    }
                    var n = new Node <OAuthCredentials>(credentials);
                    node.Nested.Add(n);
                    var tn = new TreeNode {
                        Tag = n
                    };
                    curent.Nodes.Add(tn);
                    UpdateNode(tn);
                }
            }
        }