CheckRepoPathAndName() public method

Check local repository path and repo name.
public CheckRepoPathAndName ( string localpath, string reponame ) : string
localpath string
reponame string
return string
Exemplo n.º 1
0
        private void CheckCustomizeInput(TextBox localfolder_box, TextBox localrepopath_box, TextBlock localfolder_error_label)
        {
            string error = Controller.CheckRepoPathAndName(localrepopath_box.Text, localfolder_box.Text);

            if (!String.IsNullOrEmpty(error))
            {
                localfolder_error_label.Text       = error;
                localfolder_error_label.Visibility = Visibility.Visible;
                localfolder_error_label.Foreground = Brushes.Red;
            }
            else
            {
                try
                {
                    Controller.CheckRepoPathExists(localrepopath_box.Text);
                    localfolder_error_label.Visibility = Visibility.Hidden;
                }
                catch (ArgumentException e)
                {
                    localfolder_error_label.Visibility = Visibility.Visible;
                    localfolder_error_label.Foreground = Brushes.Orange;
                    localfolder_error_label.Text       = e.Message;
                }
            }
        }
Exemplo n.º 2
0
        private void CheckCustomizeInput(NSTextField localfolder_box, NSTextField localrepopath_box, NSTextField localfolder_error_label)
        {
            string error = Controller.CheckRepoPathAndName(localrepopath_box.StringValue, localfolder_box.StringValue);

            if (!String.IsNullOrEmpty(error))
            {
                localfolder_error_label.StringValue = error;
                localfolder_error_label.TextColor   = NSColor.Red;
            }
            else
            {
                try
                {
                    Controller.CheckRepoPathExists(localrepopath_box.StringValue);
                    localfolder_error_label.StringValue = "";
                }
                catch (ArgumentException e)
                {
                    localfolder_error_label.TextColor   = NSColor.Orange;
                    localfolder_error_label.StringValue = e.Message;
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
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);
        }