Exemple #1
0
 partial void OnFinish(MonoMac.Foundation.NSObject sender)
 {
     Loader.Cancel();
     RemoveEvent();
     Ignores = NodeModelUtils.GetIgnoredFolder(Repo);
     Controller.SaveFolder();
     Controller.CloseWindow();
 }
Exemple #2
0
 partial void OnFinish(MonoMac.Foundation.NSObject sender)
 {
     lock (loginLock)
     {
         isClosed = true;
     }
     Loader.Cancel();
     RemoveEvent();
     Ignores = NodeModelUtils.GetIgnoredFolder(Repo);
     Credentials.Password = PasswordText.StringValue;
     Controller.SaveFolder();
     Controller.CloseWindow();
 }
        partial void OnContinue(MonoMac.Foundation.NSObject sender)
        {
            RootFolder root = Repositories.Find(x => (x.Selected != false));

            if (root != null)
            {
                RemoveEvent();
                foreach (AsyncNodeLoader task in Loader.Values)
                {
                    task.Cancel();
                }
                Controller.saved_repository = root.Id;
                List <string> ignored  = NodeModelUtils.GetIgnoredFolder(root);
                List <string> selected = NodeModelUtils.GetSelectedFolder(root);
                Controller.Add2PageCompleted(root.Id, root.Path, ignored.ToArray(), selected.ToArray());
            }
        }
Exemple #4
0
        private void LoadAddSelectRepoWPF()
        {
            // UI elements.
            Header = Properties_Resources.Which;

            // A tree allowing the user to browse CMIS repositories/folders.
            System.Uri resourceTreeLocater            = new System.Uri("/DataSpaceSync;component/FolderTreeMVC/TreeView.xaml", System.UriKind.Relative);
            System.Windows.Controls.TreeView treeView = System.Windows.Application.LoadComponent(resourceTreeLocater) as TreeView;

            ObservableCollection <RootFolder> repos = new ObservableCollection <RootFolder>();

            loader = new Dictionary <string, AsyncNodeLoader>();
            // Some CMIS servers hold several repositories (ex:Nuxeo). Show one root per repository.
            bool firstRepo = true;

            foreach (var repository in Controller.repositories)
            {
                RootFolder repo = new RootFolder()
                {
                    Name    = repository.Name,
                    Id      = repository.Id,
                    Address = Controller.saved_address.ToString()
                };
                repos.Add(repo);
                if (firstRepo)
                {
                    repo.Selected = true;
                    firstRepo     = false;
                }
                else
                {
                    repo.Selected = false;
                }

                CmisRepoCredentials cred = new CmisRepoCredentials()
                {
                    UserName = Controller.saved_user,
                    Password = Controller.saved_password,
                    Address  = Controller.saved_address,
                    Binding  = Controller.saved_binding,
                    RepoId   = repository.Id
                };
                AsyncNodeLoader asyncLoader = new AsyncNodeLoader(repo, cred, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
                //  GUI workaround to remove ignore folder {{
                //asyncLoader.Load(repo);
                //loader.Add(repo.Id, asyncLoader);
                repo.Status = LoadingStatus.DONE;
                //  GUI workaround to remove ignore folder }}
            }

            treeView.DataContext = repos;
            treeView.AddHandler(TreeViewItem.ExpandedEvent, new RoutedEventHandler(delegate(object sender, RoutedEventArgs e) {
                TreeViewItem expandedItem = e.OriginalSource as TreeViewItem;
                Node expandedNode         = expandedItem.Header as Folder;
                if (expandedNode != null)
                {
                    Node parent = expandedNode.Parent;
                    while (parent is Folder)
                    {
                        parent = parent.Parent;
                    }

                    if (parent is RootFolder)
                    {
                        AsyncNodeLoader l;
                        RootFolder r = parent as RootFolder;
                        if (loader.TryGetValue(r.Id, out l))
                        {
                            l.Load(expandedNode);
                        }
                    }
                }
            }));

            ContentCanvas.Children.Add(treeView);
            Canvas.SetTop(treeView, 70);
            Canvas.SetLeft(treeView, 185);

            System.Uri  resourceLocater = new System.Uri("/DataSpaceSync;component/SetupAddSelectRepoWPF.xaml", System.UriKind.Relative);
            UserControl LoadXAML        = Application.LoadComponent(resourceLocater) as UserControl;

            back_button     = LoadXAML.FindName("back_button") as Button;
            continue_button = LoadXAML.FindName("continue_button") as Button;
            cancel_button   = LoadXAML.FindName("cancel_button") as Button;

            continue_button.IsEnabled = !firstRepo;

            ContentCanvas.Children.Add(LoadXAML);

            // Actions
            cancel_button.Click += delegate {
                SelectRepoCancelAction();
                Controller.PageCancelled();
            };

            continue_button.Click += delegate {
                List <string>  ignored        = new List <string>();
                List <string>  selectedFolder = new List <string>();
                ItemCollection items          = treeView.Items;
                RootFolder     selectedRepo   = null;
                foreach (var item in items)
                {
                    RootFolder repo = item as RootFolder;
                    if (repo != null)
                    {
                        if (repo.Selected != false)
                        {
                            selectedRepo = repo;
                            break;
                        }
                    }
                }

                if (selectedRepo != null)
                {
                    ignored.AddRange(NodeModelUtils.GetIgnoredFolder(selectedRepo));
                    selectedFolder.AddRange(NodeModelUtils.GetSelectedFolder(selectedRepo));
                    Controller.saved_repository  = selectedRepo.Id;
                    Controller.saved_remote_path = selectedRepo.Path;
                    SelectRepoCancelAction();
                    Controller.Add2PageCompleted(
                        Controller.saved_repository, Controller.saved_remote_path, ignored.ToArray(), selectedFolder.ToArray());
                }
                else
                {
                    return;
                }
            };

            back_button.Click += delegate {
                SelectRepoCancelAction();
                Controller.BackToPage1();
            };
        }
Exemple #5
0
        private void ShowAdd2Page()
        {
            CmisTreeStore cmisStore = new CmisTreeStore();

            Gtk.TreeView treeView = new Gtk.TreeView(cmisStore);

            bool firstRepo = true;
            List <RootFolder> repositories = new List <RootFolder>();
            Dictionary <string, AsyncNodeLoader> loader = new Dictionary <string, AsyncNodeLoader>();

            foreach (var repository in this.controller.repositories)
            {
                RootFolder root = new RootFolder()
                {
                    Name    = repository.Name,
                    Id      = repository.Id,
                    Address = this.controller.saved_address.ToString()
                };
                if (firstRepo)
                {
                    root.Selected = true;
                    firstRepo     = false;
                }
                else
                {
                    root.Selected = false;
                }

                repositories.Add(root);
                CmisRepoCredentials cred = new CmisRepoCredentials()
                {
                    UserName = this.controller.saved_user,
                    Password = this.controller.saved_password,
                    Address  = this.controller.saved_address,
                    RepoId   = repository.Id
                };
                AsyncNodeLoader asyncLoader = new AsyncNodeLoader(root, cred, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
                asyncLoader.UpdateNodeEvent += delegate {
                    cmisStore.UpdateCmisTree(root);
                };
                cmisStore.UpdateCmisTree(root);
            }

            this.Header = Properties_Resources.Which;

            VBox layout_vertical = new VBox(false, 12);

            Button cancel_button = new Button(this.cancelText);

            cancel_button.Clicked += delegate {
                foreach (AsyncNodeLoader task in loader.Values)
                {
                    task.Cancel();
                }

                this.controller.PageCancelled();
            };

            Button continue_button = new Button(this.continueText)
            {
                Sensitive = repositories.Count > 0
            };

            continue_button.Clicked += delegate {
                RootFolder root = repositories.Find(x => (x.Selected != false));
                if (root != null)
                {
                    foreach (AsyncNodeLoader task in loader.Values)
                    {
                        task.Cancel();
                    }

                    this.controller.saved_repository = root.Id;
                    List <string> ignored  = NodeModelUtils.GetIgnoredFolder(root);
                    List <string> selected = NodeModelUtils.GetSelectedFolder(root);
                    this.controller.Add2PageCompleted(root.Id, root.Path, ignored.ToArray(), selected.ToArray());
                }
            };

            Button back_button = new Button(this.backText)
            {
                Sensitive = true
            };

            back_button.Clicked += delegate {
                foreach (AsyncNodeLoader task in loader.Values)
                {
                    task.Cancel();
                }

                this.controller.BackToPage1();
            };

            treeView.HeadersVisible = false;
            treeView.Selection.Mode = SelectionMode.Single;

            TreeViewColumn column = new TreeViewColumn();

            column.Title = "Name";
            CellRendererToggle renderToggle = new CellRendererToggle();

            column.PackStart(renderToggle, false);
            renderToggle.Activatable = true;
            column.AddAttribute(renderToggle, "active", (int)CmisTreeStore.Column.ColumnSelected);
            column.AddAttribute(renderToggle, "inconsistent", (int)CmisTreeStore.Column.ColumnSelectedThreeState);
            column.AddAttribute(renderToggle, "radio", (int)CmisTreeStore.Column.ColumnRoot);
            renderToggle.Toggled += delegate(object render, ToggledArgs args) {
                TreeIter iterToggled;
                if (!cmisStore.GetIterFromString(out iterToggled, args.Path))
                {
                    Console.WriteLine("Toggled GetIter Error " + args.Path);
                    return;
                }

                Node node = cmisStore.GetValue(iterToggled, (int)CmisTreeStore.Column.ColumnNode) as Node;
                if (node == null)
                {
                    Console.WriteLine("Toggled GetValue Error " + args.Path);
                    return;
                }

                RootFolder selectedRoot = repositories.Find(x => (x.Selected != false));
                Node       parent       = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }

                RootFolder root = parent as RootFolder;
                if (root != selectedRoot)
                {
                    selectedRoot.Selected = false;
                    cmisStore.UpdateCmisTree(selectedRoot);
                }

                if (node.Parent == null)
                {
                    node.Selected = true;
                }
                else
                {
                    node.Selected = !node.Selected;
                }

                cmisStore.UpdateCmisTree(root);
            };
            CellRendererText renderText = new CellRendererText();

            column.PackStart(renderText, false);
            column.SetAttributes(renderText, "text", (int)CmisTreeStore.Column.ColumnName);
            column.Expand = true;
            treeView.AppendColumn(column);

            treeView.RowExpanded += delegate(object o, RowExpandedArgs args) {
                Node node   = cmisStore.GetValue(args.Iter, (int)CmisTreeStore.Column.ColumnNode) as Node;
                Node parent = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }

                RootFolder root = parent as RootFolder;
                loader[root.Id].Load(node);
            };

            ScrolledWindow sw = new ScrolledWindow()
            {
                ShadowType = Gtk.ShadowType.In
            };

            sw.Add(treeView);

            layout_vertical.PackStart(new Label(string.Empty), false, false, 0);
            layout_vertical.PackStart(sw, true, true, 0);
            this.Add(layout_vertical);
            this.AddButton(back_button);
            this.AddButton(cancel_button);
            this.AddButton(continue_button);

            if (repositories.Count > 0)
            {
                continue_button.GrabDefault();
                continue_button.GrabFocus();
            }
            else
            {
                back_button.GrabDefault();
                back_button.GrabFocus();
            }
        }
Exemple #6
0
        void ShowFolderSeletionPage()
        {
            Header      = Properties_Resources.Which;
            Description = "";
            bool firstRepo = true;

            Repositories = new List <RootFolder>();
            Loader       = new Dictionary <string, AsyncNodeLoader> ();
            foreach (KeyValuePair <String, String> repository in Controller.repositories)
            {
                RootFolder repo = new RootFolder()
                {
                    Name    = repository.Value,
                    Id      = repository.Key,
                    Address = Controller.saved_address.ToString()
                };
                Repositories.Add(repo);
                if (firstRepo)
                {
                    repo.Selected = true;
                    firstRepo     = false;
                }
                else
                {
                    repo.Selected = false;
                }
                CmisRepoCredentials cred = new CmisRepoCredentials()
                {
                    UserName = Controller.saved_user,
                    Password = Controller.saved_password,
                    Address  = Controller.saved_address,
                    RepoId   = repository.Key
                };
                AsyncNodeLoader asyncLoader = new AsyncNodeLoader(repo, cred, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
                asyncLoader.UpdateNodeEvent += delegate {
                    InvokeOnMainThread(delegate {
                        DataSource.UpdateCmisTree(repo);
                        NSOutlineView view = OutlineController.OutlineView();
                        for (int i = 0; i < view.RowCount; ++i)
                        {
                            view.ReloadItem(view.ItemAtRow(i));
                        }
                    });
                };
                asyncLoader.Load(repo);
                Loader.Add(repo.Id, asyncLoader);
            }
            DataSource = new CmisTree.CmisTreeDataSource(Repositories);
            DataSource.SelectedEvent += delegate(NSCmisTree cmis, int selected) {
                InvokeOnMainThread(delegate {
                    RootFolder selectedRoot = null;
                    foreach (RootFolder root in Repositories)
                    {
                        Node node = cmis.GetNode(root);
                        if (node != null)
                        {
                            if (node.Parent == null && node.Selected == false)
                            {
                                selectedRoot = root;
                            }
                            node.Selected = (selected != 0);
                            DataSource.UpdateCmisTree(root);
                        }
                    }

                    NSOutlineView view = OutlineController.OutlineView();
                    if (selectedRoot != null)
                    {
                        foreach (RootFolder root in Repositories)
                        {
                            if (root != selectedRoot)
                            {
                                root.Selected = false;
                                DataSource.UpdateCmisTree(root);
                            }
                        }
                        view.ReloadData();
                    }
                    else
                    {
                        for (int i = 0; i < view.RowCount; ++i)
                        {
                            view.ReloadItem(view.ItemAtRow(i));
                        }
                    }
                });
            };
            DataDelegate      = new OutlineViewDelegate();
            OutlineController = new CmisOutlineController(DataSource, DataDelegate);
            ContinueButton    = new NSButton()
            {
                Title   = Properties_Resources.Continue,
                Enabled = (Repositories.Count > 0)
            };
            CancelButton = new NSButton()
            {
                Title = Properties_Resources.Cancel
            };
            NSButton BackButton = new NSButton()
            {
                Title = Properties_Resources.Back
            };

//            DataDelegate.SelectionChanged += delegate
//            {
//                InvokeOnMainThread(delegate {
//                    NSOutlineView view = OutlineController.OutlineView();
//                    if (view.SelectedRow >= 0) {
//                        ContinueButton.Enabled = true;
//                    } else {
//                        ContinueButton.Enabled = false;
//                    }
//                });
//            };
            DataDelegate.ItemExpanded += delegate(NSNotification notification)
            {
                InvokeOnMainThread(delegate {
                    NSCmisTree cmis = notification.UserInfo["NSObject"] as NSCmisTree;
                    if (cmis == null)
                    {
                        Console.WriteLine("ItemExpanded Error");
                        return;
                    }

                    NSCmisTree cmisRoot = cmis;
                    while (cmisRoot.Parent != null)
                    {
                        cmisRoot = cmisRoot.Parent;
                    }
                    RootFolder root = Repositories.Find(x => x.Name.Equals(cmisRoot.Name));
                    if (root == null)
                    {
                        Console.WriteLine("ItemExpanded find root Error");
                        return;
                    }

                    Node node = cmis.GetNode(root);
                    if (node == null)
                    {
                        Console.WriteLine("ItemExpanded find node Error");
                        return;
                    }
                    Loader[root.Id].Load(node);
                });
            };
            ContinueButton.Activated += delegate
            {
                InvokeOnMainThread(delegate {
                    NSOutlineView view = OutlineController.OutlineView();
//                    NSCmisTree cmis = (NSCmisTree)(view.ItemAtRow(view.SelectedRow));
//                    while (cmis.Parent != null)
//                        cmis = cmis.Parent;
//                    RootFolder root = Repositories.Find(x=>x.Name.Equals(cmis.Name));
                    RootFolder root = Repositories.Find(x => (x.Selected != false));
                    if (root != null)
                    {
                        foreach (AsyncNodeLoader task in Loader.Values)
                        {
                            task.Cancel();
                        }
                        Controller.saved_repository = root.Id;
                        List <string> ignored       = NodeModelUtils.GetIgnoredFolder(root);
                        List <string> selected      = NodeModelUtils.GetSelectedFolder(root);
                        Controller.Add2PageCompleted(root.Id, root.Path, ignored.ToArray(), selected.ToArray());
                    }
                });
            };
            CancelButton.Activated += delegate
            {
                InvokeOnMainThread(delegate
                {
                    foreach (AsyncNodeLoader task in Loader.Values)
                    {
                        task.Cancel();
                    }
                    Controller.PageCancelled();
                });
            };
            BackButton.Activated += delegate
            {
                InvokeOnMainThread(delegate
                {
                    foreach (AsyncNodeLoader task in Loader.Values)
                    {
                        task.Cancel();
                    }
                    Controller.BackToPage1();
                });
            };

            OutlineController.View.Frame = new RectangleF(190, 60, 400, 240);
            ContentView.AddSubview(OutlineController.View);
            Buttons.Add(ContinueButton);
            Buttons.Add(BackButton);
            Buttons.Add(CancelButton);
        }
Exemple #7
0
        /// <summary>
        /// Create the UI
        /// </summary>
        private void CreateEdit()
        {
            CmisTreeStore cmisStore = new CmisTreeStore();

            Gtk.TreeView treeView = new Gtk.TreeView(cmisStore.CmisStore);

            RootFolder root = new RootFolder()
            {
                Name    = this.Name,
                Id      = credentials.RepoId,
                Address = credentials.Address.ToString()
            };

            IgnoredFolderLoader.AddIgnoredFolderToRootNode(root, Ignores);
            LocalFolderLoader.AddLocalFolderToRootNode(root, localPath);

            AsyncNodeLoader asyncLoader = new AsyncNodeLoader(root, credentials, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);

            asyncLoader.UpdateNodeEvent += delegate {
                cmisStore.UpdateCmisTree(root);
            };
            cmisStore.UpdateCmisTree(root);
            asyncLoader.Load(root);

            Header = CmisSync.Properties_Resources.EditTitle;

            VBox layout_vertical = new VBox(false, 12);

            Controller.CloseWindowEvent += delegate
            {
                asyncLoader.Cancel();
            };

            Button cancel_button = new Button(CmisSync.Properties_Resources.Cancel);

            cancel_button.Clicked += delegate {
                Close();
            };

            Button finish_button = new Button(CmisSync.Properties_Resources.SaveChanges);

            finish_button.Clicked += delegate {
                Ignores = NodeModelUtils.GetIgnoredFolder(root);
                Controller.SaveFolder();
                Close();
            };

            Gtk.TreeIter iter;
            treeView.HeadersVisible = false;
            treeView.Selection.Mode = SelectionMode.Single;

            TreeViewColumn column = new TreeViewColumn();

            column.Title = "Name";
            CellRendererToggle renderToggle = new CellRendererToggle();

            column.PackStart(renderToggle, false);
            renderToggle.Activatable = true;
            column.AddAttribute(renderToggle, "active", (int)CmisTreeStore.Column.ColumnSelected);
            column.AddAttribute(renderToggle, "inconsistent", (int)CmisTreeStore.Column.ColumnSelectedThreeState);
            column.AddAttribute(renderToggle, "radio", (int)CmisTreeStore.Column.ColumnRoot);
            renderToggle.Toggled += delegate(object render, ToggledArgs args) {
                TreeIter iterToggled;
                if (!cmisStore.CmisStore.GetIterFromString(out iterToggled, args.Path))
                {
                    Console.WriteLine("Toggled GetIter Error " + args.Path);
                    return;
                }

                Node node = cmisStore.CmisStore.GetValue(iterToggled, (int)CmisTreeStore.Column.ColumnNode) as Node;
                if (node == null)
                {
                    Console.WriteLine("Toggled GetValue Error " + args.Path);
                    return;
                }

                if (node.Parent == null)
                {
                    node.Selected = true;
                }
                else
                {
                    if (node.Selected == false)
                    {
                        node.Selected = true;
                    }
                    else
                    {
                        node.Selected = false;
                    }
                }
                cmisStore.UpdateCmisTree(root);
            };
            CellRendererText renderText = new CellRendererText();

            column.PackStart(renderText, false);
            column.SetAttributes(renderText, "text", (int)CmisTreeStore.Column.ColumnName);
            column.Expand = true;
            treeView.AppendColumn(column);

            treeView.AppendColumn("Status", new StatusCellRenderer(), "text", (int)CmisTreeStore.Column.ColumnStatus);

            treeView.RowExpanded += delegate(object o, RowExpandedArgs args) {
                Node node = cmisStore.CmisStore.GetValue(args.Iter, (int)CmisTreeStore.Column.ColumnNode) as Node;
                asyncLoader.Load(node);
            };

            ScrolledWindow sw = new ScrolledWindow()
            {
                ShadowType = Gtk.ShadowType.In
            };

            sw.Add(treeView);

            layout_vertical.PackStart(new Label(""), false, false, 0);
            layout_vertical.PackStart(sw, true, true, 0);
            Add(layout_vertical);
            AddButton(cancel_button);
            AddButton(finish_button);

            finish_button.GrabDefault();

            this.ShowAll();
        }
Exemple #8
0
        /// <summary>
        /// Create the UI
        /// </summary>
        private void CreateEdit()
        {
            RootFolder repo = new RootFolder()
            {
                Name    = FolderName,
                Id      = credentials.RepoId,
                Address = credentials.Address.ToString()
            };

            repo.Selected = true;
            IgnoredFolderLoader.AddIgnoredFolderToRootNode(repo, Ignores);
            LocalFolderLoader.AddLocalFolderToRootNode(repo, localPath);
            List <RootFolder> repos = new List <RootFolder>();

            repos.Add(repo);

            OutlineViewDelegate DataDelegate = new OutlineViewDelegate();

            CmisTree.CmisTreeDataSource DataSource = new CmisTree.CmisTreeDataSource(repos);

            CmisOutlineController OutlineController = new CmisOutlineController(DataSource, DataDelegate);

            AsyncNodeLoader asyncLoader = new AsyncNodeLoader(repo, credentials, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);

            asyncLoader.UpdateNodeEvent += delegate {
                InvokeOnMainThread(delegate {
                    DataSource.UpdateCmisTree(repo);
                    NSOutlineView view = OutlineController.OutlineView();
                    for (int i = 0; i < view.RowCount; ++i)
                    {
                        view.ReloadItem(view.ItemAtRow(i));
                    }
                });
            };
            asyncLoader.Load(repo);

            DataDelegate.ItemExpanded += delegate(NSNotification notification)
            {
                InvokeOnMainThread(delegate {
                    NSCmisTree cmis = notification.UserInfo["NSObject"] as NSCmisTree;
                    if (cmis == null)
                    {
                        Console.WriteLine("ItemExpanded Error");
                        return;
                    }

                    NSCmisTree cmisRoot = cmis;
                    while (cmisRoot.Parent != null)
                    {
                        cmisRoot = cmisRoot.Parent;
                    }
                    if (repo.Name != cmisRoot.Name)
                    {
                        Console.WriteLine("ItemExpanded find root Error");
                        return;
                    }

                    Node node = cmis.GetNode(repo);
                    if (node == null)
                    {
                        Console.WriteLine("ItemExpanded find node Error");
                        return;
                    }
                    asyncLoader.Load(node);
                });
            };
            DataSource.SelectedEvent += delegate(NSCmisTree cmis, int selected) {
                InvokeOnMainThread(delegate {
                    Node node = cmis.GetNode(repo);
                    if (node == null)
                    {
                        Console.WriteLine("SelectedEvent find node Error");
                    }
                    node.Selected = (selected != 0);
                    DataSource.UpdateCmisTree(repo);

                    NSOutlineView view = OutlineController.OutlineView();
                    for (int i = 0; i < view.RowCount; ++i)
                    {
                        try{
                            view.ReloadItem(view.ItemAtRow(i));
                        }catch (Exception e) {
                            Console.WriteLine(e);
                        }
                    }
                });
            };

            OutlineController.View.Frame = new RectangleF(190, 60, 400, 240);
            ContentView.AddSubview(OutlineController.View);

            Controller.CloseWindowEvent += delegate
            {
                asyncLoader.Cancel();
            };

            Controller.OpenWindowEvent += delegate
            {
                InvokeOnMainThread(delegate {
                    OrderFrontRegardless();
                });
            };


            NSButton finish_button = new NSButton()
            {
                Title = Properties_Resources.SaveChanges,
            };

            NSButton cancel_button = new NSButton()
            {
                Title = Properties_Resources.DiscardChanges
            };

            Buttons.Add(finish_button);
            Buttons.Add(cancel_button);

            finish_button.Activated += delegate
            {
                Ignores = NodeModelUtils.GetIgnoredFolder(repo);
                Controller.SaveFolder();
                InvokeOnMainThread(delegate {
                    PerformClose(this);
                });
            };

            cancel_button.Activated += delegate
            {
                InvokeOnMainThread(delegate {
                    PerformClose(this);
                });
            };

            this.Header      = Properties_Resources.EditTitle;
            this.Description = "";
            this.ShowAll();
        }
Exemple #9
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Edit(EditType type, CmisRepoCredentials credentials, string name, string remotePath, List <string> ignores, string localPath)
        {
            FolderName       = name;
            this.Credentials = credentials;
            this.remotePath  = remotePath;
            this.Ignores     = new List <string>(ignores);
            this.localPath   = localPath;
            this.type        = type;
            this.backgroundWorker.WorkerSupportsCancellation = true;
            this.backgroundWorker.DoWork             += CheckPassword;
            this.backgroundWorker.RunWorkerCompleted += PasswordChecked;

            CreateTreeView();
            LoadEdit();
            switch (type)
            {
            case EditType.EditFolder:
            //  GUI workaround to remove ignore folder {{
            //tab.SelectedItem = tabItemSelection;
            //break;
            //  GUI workaround to remove ignore folder }}
            case EditType.EditCredentials:
                tab.SelectedItem = tabItemCredentials;
                break;

            default:
                break;
            }

            this.Title       = Properties_Resources.EditTitle;
            this.Description = "";
            this.ShowAll();

            // Defines how to show the setup window.
            Controller.OpenWindowEvent += delegate
            {
                Dispatcher.BeginInvoke((Action) delegate
                {
                    Show();
                    Activate();
                    BringIntoView();
                });
            };

            Controller.CloseWindowEvent += delegate
            {
                Close();
            };

            finishButton.Click += delegate
            {
                Ignores = NodeModelUtils.GetIgnoredFolder(repo);
                Credentials.Password = passwordBox.Password;
                Controller.SaveFolder();
                Controller.CloseWindow();
            };

            cancelButton.Click += delegate
            {
                Controller.CloseWindow();
            };

            Closed += delegate
            {
                Controller.CleanWindow();
            };
        }