BackToPage2() публичный Метод

Switch back from customization to step 2 of the remote folder addition wizard.
public BackToPage2 ( ) : void
Результат void
Пример #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);
        }
Пример #2
0
        private void LoadAddCustomizeWPF()
        {
            string parentFolder = Controller.DefaultRepoPath;

            // UI elements.
            Header = Properties_Resources.Customize;

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

            localfolder_label       = LoadXAML.FindName("localfolder_label") as TextBlock;
            localfolder_box         = LoadXAML.FindName("localfolder_box") as TextBox;
            localrepopath_label     = LoadXAML.FindName("localrepopath_label") as TextBlock;
            localrepopath_box       = LoadXAML.FindName("localrepopath_box") as TextBox;
            localfolder_error_label = LoadXAML.FindName("localfolder_error_label") as TextBlock;

            choose_folder_button = LoadXAML.FindName("choose_folder_button") as Button;

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

            // init UI elements.
            string localfoldername = Controller.saved_address.Host.ToString();

            foreach (var repository in Controller.repositories)
            {
                if (repository.Id == Controller.saved_repository)
                {
                    localfoldername += "\\" + repository.Name;
                    break;
                }
            }

            localfolder_box.Text   = localfoldername;
            localrepopath_box.Text = Path.Combine(parentFolder, localfolder_box.Text);

            ContentCanvas.Children.Add(LoadXAML);

            localfolder_box.TextChanged += delegate {
                try {
                    localrepopath_box.Text = Path.Combine(parentFolder, localfolder_box.Text);
                } catch (Exception) {
                }
            };

            TaskbarItemInfo.ProgressValue = 0.0;
            TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;

            // Actions.
            ControllerCustomizeInsertAction();

            // Repo path validity.
            CheckCustomizeInput(localfolder_box, localrepopath_box, localfolder_error_label);

            localfolder_box.Select(localfolder_box.Text.Length, 0);
            localfolder_box.Focus();

            localfolder_box.TextChanged += delegate {
                CheckCustomizeInput(localfolder_box, localrepopath_box, localfolder_error_label);
            };

            localrepopath_box.TextChanged += delegate {
                CheckCustomizeInput(localfolder_box, localrepopath_box, localfolder_error_label);
            };

            // Choose a folder.
            choose_folder_button.Click += delegate {
                System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
                if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    parentFolder           = folderBrowserDialog1.SelectedPath;
                    localrepopath_box.Text = Path.Combine(parentFolder, localfolder_box.Text);
                }
            };

            // Other actions.
            cancel_button.Click += delegate {
                ControllerCustomizeRemoveAction();
                Controller.PageCancelled();
            };

            back_button.Click += delegate {
                ControllerCustomizeRemoveAction();
                Controller.BackToPage2();
            };

            continue_button.Click += delegate {
                ControllerCustomizeRemoveAction();
                Controller.CustomizePageCompleted(localfolder_box.Text, localrepopath_box.Text);
            };
        }
Пример #3
0
        private void ShowCustomizePage()
        {
            Header = CmisSync.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;
                }
            }
            Label localfolder_label = new Label()
            {
                Xalign    = 0,
                UseMarkup = true,
                Markup    = "<b>" + CmisSync.Properties_Resources.EnterLocalFolderName + "</b>"
            };

            Entry localfolder_entry = new Entry()
            {
                Text             = localfoldername,
                ActivatesDefault = false
            };

            Label localrepopath_label = new Label()
            {
                Xalign    = 0,
                UseMarkup = true,
                Markup    = "<b>" + CmisSync.Properties_Resources.ChangeRepoPath + "</b>"
            };

            Entry localrepopath_entry = new Entry()
            {
                Text = System.IO.Path.Combine(Controller.DefaultRepoPath, localfolder_entry.Text)
            };

            localfolder_entry.Changed += delegate {
                try{
                    localrepopath_entry.Text = System.IO.Path.Combine(Controller.DefaultRepoPath, localfolder_entry.Text);
                }catch (Exception) {}
            };

            Label localfolder_error_label = new Label()
            {
                Xalign    = 0,
                UseMarkup = true,
                Markup    = ""
            };

            Button cancel_button = new Button(cancelText);

            Button add_button = new Button(
                CmisSync.Properties_Resources.Add
                );

            Button back_button = new Button(
                CmisSync.Properties_Resources.Back
                );

            Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
                Gtk.Application.Invoke(delegate {
                    add_button.Sensitive = button_enabled;
                });
            };

            string error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);

            if (!String.IsNullOrEmpty(error))
            {
                localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                                                 error +
                                                 "</span>";
                localfolder_error_label.Show();
            }
            else
            {
                localfolder_error_label.Hide();
            }

            localfolder_entry.Changed += delegate {
                error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
                if (!String.IsNullOrEmpty(error))
                {
                    localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                                                     error +
                                                     "</span>";
                    localfolder_error_label.Show();
                }
                else
                {
                    localfolder_error_label.Hide();
                }
            };

            error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
            if (!String.IsNullOrEmpty(error))
            {
                localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                                                 error +
                                                 "</span>";
                localfolder_error_label.Show();
            }
            else
            {
                localfolder_error_label.Hide();
            }

            localrepopath_entry.Changed += delegate {
                error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
                if (!String.IsNullOrEmpty(error))
                {
                    localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                                                     error +
                                                     "</span>";
                    localfolder_error_label.Show();
                }
                else
                {
                    localfolder_error_label.Hide();
                }
            };

            cancel_button.Clicked += delegate {
                Controller.PageCancelled();
            };

            back_button.Clicked += delegate {
                Controller.BackToPage2();
            };

            add_button.Clicked += delegate {
                Controller.CustomizePageCompleted(localfolder_entry.Text, localrepopath_entry.Text);
            };

            VBox layout_vertical = new VBox(false, 12);

            layout_vertical.PackStart(new Label(""), false, false, 0);
            layout_vertical.PackStart(localfolder_label, true, true, 0);
            layout_vertical.PackStart(localfolder_entry, true, true, 0);
            layout_vertical.PackStart(localrepopath_label, true, true, 0);
            layout_vertical.PackStart(localrepopath_entry, true, true, 0);
            layout_vertical.PackStart(localfolder_error_label, true, true, 0);
            Add(layout_vertical);
            AddButton(back_button);
            AddButton(cancel_button);
            AddButton(add_button);
            // add_button.GrabFocus();
            localfolder_entry.GrabFocus();
            localfolder_entry.SelectRegion(0, localfolder_entry.Text.Length);
        }
Пример #4
0
 partial void OnBack(MonoMac.Foundation.NSObject sender)
 {
     RemoveEvent();
     Controller.BackToPage2();
 }
Пример #5
0
        private void ShowCustomizePage()
        {
            Header = CmisSync.Properties_Resources.ResourceManager.GetString("Customize", CultureInfo.CurrentCulture);

            Label localfolder_label = new Label()
            {
                Xalign    = 0,
                UseMarkup = true,
                Markup    = "<b>" + CmisSync.Properties_Resources.ResourceManager.GetString("EnterLocalFolderName", CultureInfo.CurrentCulture) + "</b>"
            };

            Entry localfolder_entry = new Entry()
            {
                Text             = Controller.SyncingReponame,
                ActivatesDefault = false
            };

            Label localrepopath_label = new Label()
            {
                Xalign    = 0,
                UseMarkup = true,
                Markup    = "<b>" + CmisSync.Properties_Resources.ResourceManager.GetString("ChangeRepoPath", CultureInfo.CurrentCulture) + "</b>"
            };

            Entry localrepopath_entry = new Entry()
            {
                Text = System.IO.Path.Combine(Controller.DefaultRepoPath, localfolder_entry.Text)
            };

            localfolder_entry.Changed += delegate {
                localrepopath_entry.Text = System.IO.Path.Combine(Controller.DefaultRepoPath, localfolder_entry.Text);
            };

            Label localfolder_error_label = new Label()
            {
                Xalign    = 0,
                UseMarkup = true,
                Markup    = ""
            };

            Button cancel_button = new Button(cancelText);

            Button add_button = new Button(
                CmisSync.Properties_Resources.ResourceManager.GetString("Add", CultureInfo.CurrentCulture)
                );

            Button back_button = new Button(
                CmisSync.Properties_Resources.ResourceManager.GetString("Back", CultureInfo.CurrentCulture)
                );

            Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
                Gtk.Application.Invoke(delegate {
                    add_button.Sensitive = button_enabled;
                });
            };

            string error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);

            if (!String.IsNullOrEmpty(error))
            {
                localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                                                 CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) +
                                                 "</span>";
                localfolder_error_label.Show();
            }
            else
            {
                localfolder_error_label.Hide();
            }

            localfolder_entry.Changed += delegate {
                error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
                if (!String.IsNullOrEmpty(error))
                {
                    localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                                                     CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) +
                                                     "</span>";
                    localfolder_error_label.Show();
                }
                else
                {
                    localfolder_error_label.Hide();
                }
            };

            error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
            if (!String.IsNullOrEmpty(error))
            {
                localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                                                 CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) +
                                                 "</span>";
                localfolder_error_label.Show();
            }
            else
            {
                localfolder_error_label.Hide();
            }

            localrepopath_entry.Changed += delegate {
                error = Controller.CheckRepoPathAndName(localrepopath_entry.Text, localfolder_entry.Text);
                if (!String.IsNullOrEmpty(error))
                {
                    localfolder_error_label.Markup = "<span foreground=\"#ff8080\">" +
                                                     CmisSync.Properties_Resources.ResourceManager.GetString(error, CultureInfo.CurrentCulture) +
                                                     "</span>";
                    localfolder_error_label.Show();
                }
                else
                {
                    localfolder_error_label.Hide();
                }
            };

            cancel_button.Clicked += delegate {
                Controller.PageCancelled();
            };

            back_button.Clicked += delegate {
                Controller.BackToPage2();
            };

            add_button.Clicked += delegate {
                Controller.CustomizePageCompleted(localfolder_entry.Text, localrepopath_entry.Text);
            };

            VBox layout_vertical = new VBox(false, 12);

            layout_vertical.PackStart(new Label(""), false, false, 0);
            layout_vertical.PackStart(localfolder_label, true, true, 0);
            layout_vertical.PackStart(localfolder_entry, true, true, 0);
            layout_vertical.PackStart(localrepopath_label, true, true, 0);
            layout_vertical.PackStart(localrepopath_entry, true, true, 0);
            layout_vertical.PackStart(localfolder_error_label, true, true, 0);
            Add(layout_vertical);
            AddButton(back_button);
            AddButton(add_button);
            AddButton(cancel_button);

            // add_button.GrabFocus();
            localfolder_entry.GrabFocus();
            localfolder_entry.SelectRegion(0, localfolder_entry.Text.Length);
        }