CmisSync.SetupController.CustomizePageCompleted C# (CSharp) Method

CustomizePageCompleted() public method

Customization step of remote folder addition wizard is complete, start CmisSync.
public CustomizePageCompleted ( String repoName, String localrepopath ) : void
repoName String
localrepopath String
return void
        public void CustomizePageCompleted(String repoName, String localrepopath)
        {
            try
            {
                CheckRepoPathExists(localrepopath);
            }
            catch (ArgumentException)
            {
                if (LocalPathExists != null && ! LocalPathExists(localrepopath))
                {
                    return;
                }
            }
            SyncingReponame = repoName;


            // Add the remote folder to the configuration and start syncing.
            try
            {
                Program.Controller.CreateRepository(
                    repoName,
                    saved_address,
                    saved_user.TrimEnd(),
                    saved_password.TrimEnd(),
                    PreviousRepository,
                    PreviousPath,
                    localrepopath,
                    ignoredPaths,
                    saved_syncatstartup);
            }
            catch (Exception e)
            {
                Logger.Fatal("Could not create repository.", e);
                Program.Controller.ShowAlert(Properties_Resources.Error, String.Format(Properties_Resources.SyncError, repoName, e.Message));
                FinishPageCompleted();
                return;
            }

            ChangePageEvent(PageType.Finished);
        }

Usage Example

Esempio n. 1
0
        void ShowCustomizePage()
        {
            Header = Properties_Resources.Customize;
            string localfoldername = Controller.saved_address.Host.ToString();

            foreach (KeyValuePair <String, String> repository in Controller.repositories)
            {
                if (repository.Key == Controller.saved_repository)
                {
                    localfoldername += "/" + repository.Value;
                    break;
                }
            }
            NSTextField LocalFolderLabel = new NSTextField()
            {
                Alignment       = NSTextAlignment.Left,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(190, 320, 196 + 196 + 16, 17),
                Font            = GUI.BoldFont,
                StringValue     = Properties_Resources.EnterLocalFolderName
            };
            NSTextField LocalFolderTextField = new NSTextField()
            {
                Frame       = new RectangleF(190, 290, 196 + 196 + 16, 22),
                Font        = GUI.Font,
                Delegate    = new TextFieldDelegate(),
                StringValue = localfoldername
            };
            NSTextField LocalRepoPathLabel = new NSTextField()
            {
                Alignment       = NSTextAlignment.Left,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(190, 220, 196 + 196 + 16, 17),
                Font            = GUI.BoldFont,
                StringValue     = Properties_Resources.ChangeRepoPath
            };
            NSTextField LocalRepoPathTextField = new NSTextField()
            {
                Frame       = new RectangleF(190, 190, 196 + 196 + 16 - 60, 22),
                Font        = GUI.Font,
                Delegate    = new TextFieldDelegate(),
                StringValue = Path.Combine(Controller.DefaultRepoPath, LocalFolderTextField.StringValue)
            };

            WarningTextField = new NSTextField()
            {
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                TextColor       = NSColor.Red,
                Editable        = false,
                Frame           = new RectangleF(190, 30, 196 + 196 + 16, 140),
                Font            = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande", NSFontTraitMask.Condensed, 0, 11),
            };
            WarningTextField.Cell.LineBreakMode = NSLineBreakMode.ByWordWrapping;
            ContinueButton = new NSButton()
            {
                Title   = Properties_Resources.Add,
                Enabled = false
            };
            NSButton BackButton = new NSButton()
            {
                Title = Properties_Resources.Back
            };

            CancelButton = new NSButton()
            {
                Title = Properties_Resources.Cancel
            };
            NSButton ChooseFolderButton = new NSButton()
            {
                Title = "...",
                Frame = new RectangleF(190 + 196 + 196 + 16 - 40, 190, 40, 22)
            };

            ChooseFolderButton.Activated += delegate
            {
                NSOpenPanel OpenPanel = NSOpenPanel.OpenPanel;
                OpenPanel.AllowsMultipleSelection = false;
                OpenPanel.CanChooseFiles          = false;
                OpenPanel.CanChooseDirectories    = true;
                OpenPanel.CanCreateDirectories    = true;
                OpenPanel.DirectoryUrl            = new NSUrl("file://localhost" + Controller.DefaultRepoPath);
                if (OpenPanel.RunModal() == 1)
                {
                    string path = OpenPanel.Urls[0].Path;
                    try{
                        LocalRepoPathTextField.StringValue = Path.Combine(path, LocalFolderTextField.StringValue);
                    } catch (Exception) {
                        LocalRepoPathTextField.StringValue = path;
                    }
                    CheckCustomizeInput(LocalFolderTextField, LocalRepoPathTextField, WarningTextField);
                }
            };

            BackButton.Activated += delegate
            {
                Controller.BackToPage2();
            };
            CancelButton.Activated += delegate
            {
                Controller.PageCancelled();
            };
            ContinueButton.Activated += delegate
            {
                Controller.CustomizePageCompleted(LocalFolderTextField.StringValue, LocalRepoPathTextField.StringValue);
            };
            (LocalFolderTextField.Delegate as TextFieldDelegate).StringValueChanged += delegate
            {
                try
                {
                    LocalRepoPathTextField.StringValue = Path.Combine(Controller.DefaultRepoPath, LocalFolderTextField.StringValue);
                }
                catch (Exception)
                {
                }
                CheckCustomizeInput(LocalFolderTextField, LocalRepoPathTextField, WarningTextField);
            };
            (LocalRepoPathTextField.Delegate as TextFieldDelegate).StringValueChanged += delegate
            {
                CheckCustomizeInput(LocalFolderTextField, LocalRepoPathTextField, WarningTextField);
            };
            {
                CheckCustomizeInput(LocalFolderTextField, LocalRepoPathTextField, WarningTextField);
            }
            ContentView.AddSubview(LocalFolderLabel);
            ContentView.AddSubview(LocalFolderTextField);
            ContentView.AddSubview(LocalRepoPathLabel);
            ContentView.AddSubview(LocalRepoPathTextField);
            ContentView.AddSubview(ChooseFolderButton);
            ContentView.AddSubview(WarningTextField);
            Buttons.Add(ContinueButton);
            Buttons.Add(BackButton);
            Buttons.Add(CancelButton);
        }
All Usage Examples Of CmisSync.SetupController::CustomizePageCompleted