コード例 #1
0
        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");
                }
            }
        }
コード例 #2
0
        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 = "";
            }
        }
コード例 #3
0
        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");
                }
            }
        }