protected override void OnLoadComplete(EventArgs e) { base.OnLoadComplete(e); var owner = new TextBoxGroup("Owner") { DefaultInputText = PluginMetadataCollection.REPOSITORY_OWNER }; var repo = new TextBoxGroup("Name") { DefaultInputText = PluginMetadataCollection.REPOSITORY_NAME }; var gitRef = new TextBoxGroup("Ref") { DefaultInputText = "master" }; var actions = new StackLayout { Orientation = Orientation.Horizontal, VerticalContentAlignment = VerticalAlignment.Center, Spacing = 5, Items = { new StackLayoutItem { Expand = true, Control = new Button((sender, e) => Close(null)) { Text = "Cancel" } }, new StackLayoutItem { Expand = true, Control = new Button((sender, e) => Return(owner, repo, gitRef)) { Text = "Apply" } } } }; this.Content = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Stretch, Padding = 5, Spacing = 5, Items = { new StackLayoutItem(owner), new StackLayoutItem(repo), new StackLayoutItem(gitRef), new StackLayoutItem(null, true), new StackLayoutItem(actions) } }; }
protected void btnSubmit_Click(object sender, EventArgs e) { string locationName = ""; string msg = ""; //if (ddldistrict.SelectedIndex == 0) //{ // ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Select District');", true); // return; //} //else //{ // districtid = validations.remove_bad_words(ddldistrict.SelectedItem.Value.ToString()); //} if (TextBoxGroup.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Enter Group Name');", true); return; } else { if (validations.alpha_Slash_space(TextBoxGroup.Text.Trim()) != true) { ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('Group Name: Alphabet Space and Slash(/) Only');", true); return; } else { locationName = validations.remove_bad_words(TextBoxGroup.Text.Trim()); } } if (btnSubmit.Text == "Submit") { msg = insert.insertGroup(TextBoxGroup.Text.Trim()); } else if (btnSubmit.Text == "Update") { msg = update.updateGroup("UpdateGroup", locationName, Session["GroupId"].ToString()); } if (msg != "") { Bindgrid(); TextBoxGroup.Text = ""; TextBoxGroup.Focus(); btnSubmit.Text = "Submit"; ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + msg + "');", true); } }
protected async void Return(TextBoxGroup owner, TextBoxGroup repo, TextBoxGroup gitRef) { try { var collection = await PluginMetadataCollection.DownloadAsync(owner.InputText, repo.InputText, gitRef.InputText); Close(collection); } catch (HttpRequestException httpEx) when(httpEx.StatusCode == HttpStatusCode.NotFound) { MessageBox.Show( "Unable to find the repository source that was requested.", "Error switching repository", MessageBoxButtons.OK, MessageBoxType.Error ); } catch (Exception ex) { ex.ShowMessageBox(); } }
protected async void Return(TextBoxGroup owner, TextBoxGroup repo, TextBoxGroup gitRef) { var collection = await PluginMetadataCollection.DownloadAsync(owner.InputText, repo.InputText, gitRef.InputText); Close(collection); }