public OpenFileDialog() { FileUploadButton = new FileUploadButton { UploadType = FileUploadType.TextFile, FileEncoding = FileReaderEncoding.ASCII }; }
public DialogResult ShowDialog() { FileUploadButton.SimulateClick(); FileUploadButton.Command = new ParameterizedCommand( parameter => FileUploaded?.Invoke(this, new OpenFileDialogEventArgs(parameter.Parameter as FileUploadEventArgs))); return(DialogResult.Unspecified); }
//A method to enter and save a given test data set for property details internal bool SavePropertyDetails(int TestDataSet) { try { //A variable that contains the search address used for the Google API string SearchAddressString; SearchAddressString = ExcelLib.ReadData(TestDataSet, "Number") + " " + ExcelLib.ReadData(TestDataSet, "Street") + " " + ExcelLib.ReadData(TestDataSet, "Suburb") + " " + ExcelLib.ReadData(TestDataSet, "City") + " " + ExcelLib.ReadData(TestDataSet, "PostCode") + " " + ExcelLib.ReadData(TestDataSet, "City"); //Enter the testdata into the relevant input fields PropertyName.SendKeys(ExcelLib.ReadData(TestDataSet, "Property Name")); Description.SendKeys(ExcelLib.ReadData(TestDataSet, "Description")); //Using the Google API search results to populate the address fields SearchAddress.SendKeys(SearchAddressString); Thread.Sleep(1000); SearchAddress.SendKeys(Keys.Down); SearchAddress.SendKeys(Keys.Enter); TargetRent.SendKeys(ExcelLib.ReadData(TestDataSet, "TargetRent")); Bedrooms.SendKeys(ExcelLib.ReadData(TestDataSet, "Bedrooms")); Bathrooms.SendKeys(ExcelLib.ReadData(TestDataSet, "Bathrooms")); Carparks.SendKeys(ExcelLib.ReadData(TestDataSet, "Carparks")); YearBuilt.SendKeys(ExcelLib.ReadData(TestDataSet, "YearBuilt")); //Finding the path of the Image String ImagePath = Keys_Resource.ImagePath; ImagePath = ImagePath + ExcelLib.ReadData(TestDataSet, "Photo"); //Upload the photo of the property from file FileUploadButton.SendKeys(ImagePath); Thread.Sleep(5000); //Click on the Next Button to move on to the Next Section PropertyNextButton.Click(); Thread.Sleep(1000); return(true); } catch (Exception e) { // Log the error details in the report Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Error, "Error occured when entering property details for the new property: " + e.Message.ToString()); // Save Screenshot to display the error String img = SaveScreenShotClass.SaveScreenshot(Driver.driver, "Exception Report"); Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Info, "Image example: " + img); return(false); } }
public MainForm() { _localStorage = new LocalStorageHandle(); uploader = new FileUploadButton { Command = new ParameterizedCommand(OnFileUploaded), UploadType = FileUploadType.TextFile, Visible = false, }; uploadFileBtn = new Button { Text = "Upload from Computer", Command = new DelegateCommand(UploadIt), }; downloadFileBtn = new Button { Text = "Download to Computer", Command = new DelegateCommand(DownloadIt), }; storedFilesLabel = new TextBox { PlaceholderText = "Saved Files" }; refreshStoredFiles = new Button { Text = "Refresh", FontStyle = new FontStyle() { FontSize = 12, }, Command = new DelegateCommand(ModifyStoredFiles), }; storedFiles = new TextArea { Text = "", FontStyle = new FontStyle() { FontSize = 12, }, Columns = 2, }; saveOk = new Button { Text = "OK", FontStyle = new FontStyle() { FontSize = 12 }, Command = new DelegateCommand(() => OnSaveOk()) }; loadOk = new Button { Text = "OK", FontStyle = new FontStyle() { FontSize = 12 }, Command = new DelegateCommand(OnLoadOk) }; removeOk = new Button { Text = "OK", FontStyle = new FontStyle() { FontSize = 12 }, Command = new DelegateCommand(OnRemoveOk) }; clear = new Button #region code { Text = "Clear All Files", FontStyle = new FontStyle() { FontSize = 12 }, Command = new DelegateCommand(OnClear) }; #endregion remove = new Button { Text = "Remove", FontStyle = new FontStyle() { FontSize = 12 }, Command = new DelegateCommand(OnRemove) }; removeFile = new TextBox { Text = "", FontStyle = new FontStyle() { FontSize = 12 }, }; editArea = new TextArea() { Text = "", Rows = 12, }; saveBtn = new Button() { Text = "Save", FontStyle = new FontStyle() { FontSize = 12, }, Command = new DelegateCommand(OnSave), }; loadBtn = new Button() { Text = "Load", FontStyle = new FontStyle() { FontSize = 12, }, Command = new DelegateCommand(OnLoad), }; saveFile = new TextBox() { PlaceholderText = "File name.", }; loadFile = new TextBox { PlaceholderText = "Existing file name.", }; red = new TextBox { PlaceholderText = "R", }; red.InternalJQElement.Css("width", "50px"); green = new TextBox { PlaceholderText = "G" }; green.InternalJQElement.Css("width", "50px"); blue = new TextBox { PlaceholderText = "B" }; blue.InternalJQElement.Css("width", "50px"); colorOk = new Button { Text = "OK", FontStyle = new FontStyle() { FontSize = 12, }, Command = new DelegateCommand(OnColorOk) }; color = new Button() { Text = "Color", FontStyle = new FontStyle() { FontSize = 12, }, Command = new DelegateCommand(OnColor), }; storedFilesLabel.InternalJQElement.Css("content", @"\a"); //the @ means automaticaly escape backslashes storedFilesLabel.InternalJQElement.Css("white-space", "pre"); storedFilesLabel.InternalJQElement.Css("display", "block"); Controls = new Layout() { new TextBlock() { Text = "ZetaPad", TextAlign = TextAlign.Center, FontStyle = new FontStyle() { FontSize = 24, FontWeight = FontWeight.Bold, } }, editArea, saveBtn, saveFile, saveOk, loadBtn, loadFile, loadOk, remove, removeFile, removeOk, color, red, green, blue, colorOk, clear, storedFilesLabel, storedFiles, refreshStoredFiles, downloadFileBtn, uploadFileBtn, new TextBlock() { Text = "(c) 2016 The WhatCubes Team", TextAlign = TextAlign.Center }, #region random htmlcontrol new HtmlControl() { //Elements = new ElementGroup() //{ // new AnchorElement() // { // HREF = "http://example.com", // TextContent = "This is this random link", // }, // new ParagraphElement() // { // Style = "text-align: center;", // TextContent = "Here's this random paragraph like what", // }, // new Element("video") // { // } //} }, #endregion random htmlcontrol }; editArea.Text = _localStorage.GetItem("save_state.txt") ?? ""; //THIS below red.InternalJQElement.Css("display", "none"); //hide it green.InternalJQElement.Css("display", "none"); blue.InternalJQElement.Css("display", "none"); colorOk.InternalJQElement.Css("display", "none"); saveFile.InternalJQElement.Css("display", "none"); loadFile.InternalJQElement.Css("display", "none"); removeFile.InternalJQElement.Css("display", "none"); saveOk.InternalJQElement.Css("display", "none"); loadOk.InternalJQElement.Css("display", "none"); removeOk.InternalJQElement.Css("display", "none"); }