private void Open_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); openFile.Filter = "ESGX File|*.esgx"; //openFile.InitialDirectory = Directory.GetCurrentDirectory(); openFile.CheckFileExists = true; openFile.CheckPathExists = true; openFile.RestoreDirectory = true; if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { esgx = new ESGXEntry(); esgx.ReadFile(openFile.FileName); isActiveFile = true; RefreshSGXDEntries(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "Error"); } } }
private void New_Click(object sender, RoutedEventArgs e) { esgx = new ESGXEntry(); isActiveFile = true; RefreshSGXDEntries(); foreach (System.Windows.Controls.TextBox textbox in grdSGXD.Children.OfType <System.Windows.Controls.TextBox>()) { textbox.Text = ""; } }
private void OpenES_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFile = new OpenFileDialog(); //openFile.InitialDirectory = Directory.GetCurrentDirectory(); openFile.CheckFileExists = true; openFile.CheckPathExists = true; openFile.RestoreDirectory = true; if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { esgx = new ESGXEntry(); esgx.ReadESFile(openFile.FileName); lblEstimate.Content = string.Format("Estimated File Size: {0}KB", Math.Round(double.Parse(new FileInfo(openFile.FileName).Length.ToString()) / 1000, 1).ToString()); if (Math.Round(fileSize / 1000, 1) >= 200) { lblEstimate.Foreground = Brushes.Red; } else { lblEstimate.Foreground = Brushes.Black; } isActiveFile = true; RefreshSGXDEntries(false, true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "Error"); } } }