public static bool DownlaodFile(string downloadFileName) { string url = Constants.DOWNLOADSITEURL; string downloadPath = ""; var ss = CommonFunctions.GetFromReg(Constants.DOWNLOAD_FOLDER_PATH); if (ss != null && ss.Trim().Length > 0) { downloadPath = ss; } else { downloadPath = Application.StartupPath + @"\Downloads\"; } if (!Directory.Exists(downloadPath)) { Directory.CreateDirectory(downloadPath); } Boolean isFileDownloaded = CommonFunctions.Download(url, downloadFileName, downloadPath); if (isFileDownloaded) { return(true); } else { return(false); } }
private void frmCodeZen_Load(object sender, EventArgs e) { var ss = CommonFunctions.GetFromReg(Constants.DOWNLOAD_FOLDER_PATH); if (!(ss != null && ss.Trim().Length > 0)) { var downloadPath = Application.StartupPath + @"\Downloads\"; CommonFunctions.SaveToRig(Constants.DOWNLOAD_FOLDER_PATH, downloadPath); } }
private void frmDownloadFilePath_Load(object sender, EventArgs e) { var ss = CommonFunctions.GetFromReg(Constants.DOWNLOAD_FOLDER_PATH); if (ss != null && ss.Trim().Length > 0) { textBox1.Text = ss; } else { var downloadPath = Application.StartupPath + @"\Downloads\"; CommonFunctions.SaveToRig(Constants.DOWNLOAD_FOLDER_PATH, downloadPath); textBox1.Text = downloadPath; } }
private static async Task PostData(string pr) { var fr = new FilePr(); fr.Name = pr; fr.ChangedName = pr; ////using (var client = new HttpClient()) ////{ //// client.BaseAddress = new Uri(Constants.SITEURL); //// var content = new FormUrlEncodedContent(new[] //// { //// new KeyValuePair<string, string>("", "pr") //// }); //// var result = await client.PostAsync("/CodeGen", content); //// string resultContent = await result.Content.ReadAsStringAsync(); //// Console.WriteLine(resultContent); ////} using (var client = new HttpClient()) { client.BaseAddress = new Uri(Constants.SITEURL); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = await client.PostAsJsonAsync("CodeGen", fr).ConfigureAwait(false); if (response.IsSuccessStatusCode) { PushOutPut("Success."); var result = await response.Content.ReadAsAsync <string>(); PushOutPut("Downloading File."); if (DownlaodFile(result)) { PushOutPut("Successfully downloaded the to : " + CommonFunctions.GetFromReg(Constants.DOWNLOAD_FOLDER_PATH) + "\\" + result); MessageBox.Show("Completed. Downloaded the file to : " + CommonFunctions.GetFromReg(Constants.DOWNLOAD_FOLDER_PATH) + "\\" + result); } //PushOutPut(result); } else { PushOutPut(response.ToString()); } } }
private void button1_Click(object sender, EventArgs e) { folderBrowserDialog1.SelectedPath = CommonFunctions.GetFromReg(Constants.DOWNLOAD_FOLDER_PATH); var xx = folderBrowserDialog1.ShowDialog(); if (xx == DialogResult.Cancel) { return; } var str1 = folderBrowserDialog1.SelectedPath; if (str1 != "") { textBox1.Text = str1; CommonFunctions.SaveToRig(Constants.DOWNLOAD_FOLDER_PATH, str1); } }
public frmConnectionString() { InitializeComponent(); textBox1.Text = CommonFunctions.GetFromReg(Constants.CONNECTIONSTRING); }
private void toolStripMenuItem3_Click(object sender, EventArgs e) { var pr3 = new NgProject2(); var constr = CommonFunctions.GetFromReg(Constants.CONNECTIONSTRING); if (constr != "") { var NewTables = DB.FetchDBSchema(constr); var pr2 = new NgProject2(); NgMenu2 mn = new NgMenu2("Tables"); mn.Name = "Tables"; pr2 = SetTreeView1(mn, NewTables); pr3.RadiosList = pr.RadiosList; pr3.CombosList = pr.CombosList; pr3.NetProject.DataBaseConnectionString = pr.NetProject.DataBaseConnectionString; foreach (var xx in pr2.Menues) { var mn1 = new NgMenu2(); mn1.Name = Constants.MENUNAME; mn1.Index = xx.Index; foreach (var yy in xx.Submenues) { var sub1 = new NgSubMenu2(); var sub = CommonFunctions.GetSubMenu(pr, yy.Name); if (sub != null) { CommonFunctions.CopySubMenu(sub, sub1); var cf = 0; foreach (var zz in yy.Model.Fields) { cf++; var zz1 = CommonFunctions.GetField(sub, zz.OriginalName); if (zz1 != null) { zz1.Length = zz.Length; sub1.Model.Fields.Add(zz1); } else { sub1.Model.Fields.Add(zz); } } mn1.Submenues.Add(sub1); } else { CommonFunctions.CopySubMenu(yy, sub1); foreach (var zz in yy.Model.Fields) { var zz1 = new NgField2(); CommonFunctions.CopyField(zz, zz1); zz1.Length = zz.Length; sub1.Model.Fields.Add(zz1); } mn1.Submenues.Add(sub1); } } pr3.Menues.Add(mn1); } } pr = pr3; SetTreeView(); MessageBox.Show("Done"); }