private void btnDialogOk_Click(object sender, RoutedEventArgs e) { string pattern = "^[a-zA-Z0-9]+$"; string d = ((MainWindow)Application.Current.MainWindow).textBox.Text; string path = ConfigurationManager.ConnectionStrings["SqLiteBase"].ToString(); bool result = SqLiteFunc.GetImportedFileList(path).Contains(txtAnswer.Text); if (Regex.IsMatch(txtAnswer.Text, pattern, RegexOptions.IgnoreCase)) { if (result == false) { ((MainWindow)Application.Current.MainWindow).GetLoadSingle(txtAnswer.Text + FormatList.Text); } SqLiteFunc.Insert(path, txtAnswer.Text + FormatList.Text, d, FormatList.Text); ((MainWindow)Application.Current.MainWindow).Title = txtAnswer.Text + FormatList.Text; this.Close(); } else { MessageBox.Show("Invalid name"); } }
private void openMenuItem_Click(object sender, System.EventArgs e) { var myItemsMenuItems = sender as MenuItem; string d = Convert.ToString(myItemsMenuItems.Header); this.Title = d; textBox.Text = SqLiteFunc.Open(PathFileSqLiteBase, d); }
public void GetLoadList (string PathData) { foreach (string FileName in SqLiteFunc.GetImportedFileList(PathData)) { MenuItem fileMenuItem = new MenuItem(); fileMenuItem.Header = FileName; fileMenuItem.Click += openMenuItem_Click; ListFiles.Items.Add(fileMenuItem); } }
public MainWindow() { InitializeComponent(); // CompressBase.Compress(); if (File.Exists(PathFolderSqLiteBase + PathFileNameSqLiteBase + ".zip") != true) { SqLiteFunc.CreateDb(PathFileSqLiteBase); }else { CompressBase.DeCompress(PathFolderSqLiteBase, PathFileNameSqLiteBase); GetLoadList(PathFileSqLiteBase); // File.Delete(PathFolderSqLiteBase + PathFileNameSqLiteBase + ".zip"); } }