Beispiel #1
0
        private void MenuItem_SaveAs_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog
            {
                Filter = defaultExt
            };
            string newFile = "";

            if (saveFileDialog1.ShowDialog() == true)
            {
                SavedFile instance = new SavedFile();
                SaveToInstance(instance);

                using (Stream output = File.Create(saveFileDialog1.FileName))
                {
                    BinaryFormatter formatter = new BinaryFormatter();
                    formatter.Serialize(output, instance);
                }
                thisInstance = instance;
                newFile      = saveFileDialog1.FileName;
                ShowToUpdate();
            }
            this.Title = defaultTitle + " (" + newFile + ")";
            MessageBox.Show("Saved!", "Saving", MessageBoxButton.OK, MessageBoxImage.Asterisk);
        }
Beispiel #2
0
        private void MenuItem_Open_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog
            {
                Filter = defaultExt
            };

            if (openFileDialog1.ShowDialog() == true)
            {
                SavedFile instance;

                using (Stream input = File.Open(openFileDialog1.FileName, FileMode.Open))
                {
                    BinaryFormatter formatter = new BinaryFormatter();
                    instance    = (SavedFile)formatter.Deserialize(input);
                    this.Title += " (" + openFileDialog1.FileName + ")";
                    thisFile    = openFileDialog1.FileName;
                }

                ReadFromInstance(instance);
                Refresh_SLS_Crack_Graph();
                Refresh_SLS_Stresses_Graph();
                Refresh_ULS_MN_Graph();
                Refresh_ULS_VN_Graph();
                dataGrid_ULS_MN.ItemsSource  = points_MN;
                dataGrid_ULS_VN.ItemsSource  = points_VN;
                dataGrid_SLS_CHR.ItemsSource = points_SLS_CHR;
                dataGrid_SLS_QPR.ItemsSource = points_SLS_QPR;

                thisInstance = instance;
            }
        }
Beispiel #3
0
        private void MenuItem_Save_Click(object sender, RoutedEventArgs e)
        {
            if (String.Equals(thisFile, ""))
            {
                MenuItem_SaveAs_Click(sender, e);
            }
            else
            {
                SavedFile instance = new SavedFile();
                SaveToInstance(instance);

                using (Stream output = File.Create(thisFile))
                {
                    BinaryFormatter formatter = new BinaryFormatter();
                    formatter.Serialize(output, instance);
                }
                thisInstance = instance;
                ShowToUpdate();
            }
            MessageBox.Show("Saved!", "Saving", MessageBoxButton.OK, MessageBoxImage.Asterisk);
        }
Beispiel #4
0
        private void SaveToInstance(SavedFile instance)
        {
            instance.section1 = section1;
            instance.section2 = section2;

            instance.stirrups1 = stirrups1;
            instance.stirrups2 = stirrups2;

            instance.section1_h  = textBox_height_1.Text;
            instance.section2_h  = textBox_height_2.Text;
            instance.section1_b  = textBox_width_1.Text;
            instance.section2_b  = textBox_width_1.Text;
            instance.section1_c1 = textBox_cover_As1_1.Text;
            instance.section1_c2 = textBox_cover_As2_1.Text;
            instance.section2_c1 = textBox_cover_As1_2.Text;
            instance.section2_c2 = textBox_cover_As2_2.Text;

            instance.diameter_As1_1        = comboBox_diameter_As1_1.SelectedIndex;
            instance.diameter_As2_1        = comboBox_diameter_As2_1.SelectedIndex;
            instance.diameter_As1_2        = comboBox_diameter_As1_2.SelectedIndex;
            instance.diameter_As2_2        = comboBox_diameter_As2_2.SelectedIndex;
            instance.section1_As1_noOfBars = comboBox_As1_spac_no_1.SelectedIndex;
            instance.section1_As2_noOfBars = comboBox_As2_spac_no_1.SelectedIndex;
            instance.section2_As1_noOfBars = comboBox_As1_spac_no_2.SelectedIndex;
            instance.section2_As2_noOfBars = comboBox_As2_spac_no_2.SelectedIndex;
            instance.spac_no_As1_1         = textBox_spac_no_As1_1.Text;
            instance.spac_no_As2_1         = textBox_spac_no_As1_2.Text;
            instance.spac_no_As1_2         = textBox_spac_no_As2_1.Text;
            instance.spac_no_As2_2         = textBox_spac_no_As2_2.Text;

            instance.concrete1 = comboBox_Concrete_1.SelectedIndex;
            instance.concrete2 = comboBox_Concrete_2.SelectedIndex;

            instance.steel1 = comboBox_Steel_1.SelectedIndex;
            instance.steel2 = comboBox_Steel_2.SelectedIndex;

            instance.section1DS = comboBox_DesignSituation_1.SelectedIndex;
            instance.section2DS = comboBox_DesignSituation_2.SelectedIndex;

            instance.diameter_stir_s1 = comboBox_diameter_AsStir_1.SelectedIndex;
            instance.diameter_stir_s2 = comboBox_diameter_AsStir_2.SelectedIndex;
            instance.legs_stir_s1     = textBox_legs_1.Text;
            instance.legs_stir_s2     = textBox_legs_2.Text;
            instance.spacing_stir_s1  = textBox_stir_spacing_1.Text;
            instance.spacing_stir_s2  = textBox_stir_spacing_2.Text;
            instance.angle_stir_s1    = textBox_stir_angle_1.Text;
            instance.angle_stir_s2    = textBox_stir_angle_2.Text;

            instance.tabSLS_ConcreteStress = tabSLS_ConcreteStress;
            instance.tabSLS_SteelStress    = tabSLS_SteelStress;
            instance.tabVRd1         = tabVRd1;
            instance.tabVRdc1        = tabVRdc1;
            instance.tabSLS_NonCrack = tabSLS_NonCrack;
            instance.tabSLS_Crack    = tabSLS_Crack;
            instance.tab1_ULS        = tab1_ULS;
            instance.tab2_ULS        = tab2_ULS;

            instance.points_MN      = points_MN;
            instance.points_SLS_CHR = points_SLS_CHR;
            instance.points_SLS_QPR = points_SLS_QPR;
            instance.points_VN      = points_VN;

            instance.creep1 = textBox_creep1.Text;
            instance.creep2 = textBox_creep2.Text;
        }
Beispiel #5
0
        private void ReadFromInstance(SavedFile instance)
        {
            section1 = instance.section1;
            section2 = instance.section2;

            stirrups1 = instance.stirrups1;
            stirrups2 = instance.stirrups2;

            textBox_height_1.Text    = instance.section1_h;
            textBox_height_2.Text    = instance.section2_h;
            textBox_width_1.Text     = instance.section1_b;
            textBox_width_2.Text     = instance.section2_b;
            textBox_cover_As1_1.Text = instance.section1_c1;
            textBox_cover_As2_1.Text = instance.section1_c2;
            textBox_cover_As1_2.Text = instance.section2_c1;
            textBox_cover_As2_2.Text = instance.section2_c2;

            comboBox_diameter_As1_1.SelectedIndex = instance.diameter_As1_1;
            comboBox_diameter_As2_1.SelectedIndex = instance.diameter_As2_1;
            comboBox_diameter_As1_2.SelectedIndex = instance.diameter_As1_2;
            comboBox_diameter_As2_2.SelectedIndex = instance.diameter_As2_2;
            comboBox_As1_spac_no_1.SelectedIndex  = instance.section1_As1_noOfBars;
            comboBox_As2_spac_no_1.SelectedIndex  = instance.section1_As2_noOfBars;
            comboBox_As1_spac_no_2.SelectedIndex  = instance.section2_As1_noOfBars;
            comboBox_As2_spac_no_2.SelectedIndex  = instance.section2_As2_noOfBars;
            textBox_spac_no_As1_1.Text            = instance.spac_no_As1_1;
            textBox_spac_no_As2_1.Text            = instance.spac_no_As2_1;
            textBox_spac_no_As1_2.Text            = instance.spac_no_As1_2;
            textBox_spac_no_As2_2.Text            = instance.spac_no_As2_2;

            comboBox_Concrete_1.SelectedIndex        = instance.concrete1;
            comboBox_Concrete_2.SelectedIndex        = instance.concrete2;
            comboBox_Steel_1.SelectedIndex           = instance.steel1;
            comboBox_Steel_2.SelectedIndex           = instance.steel2;
            comboBox_DesignSituation_1.SelectedIndex = instance.section1DS;
            comboBox_DesignSituation_2.SelectedIndex = instance.section2DS;

            comboBox_diameter_AsStir_1.SelectedIndex = instance.diameter_stir_s1;
            comboBox_diameter_AsStir_2.SelectedIndex = instance.diameter_stir_s2;
            textBox_legs_1.Text         = instance.legs_stir_s1;
            textBox_legs_2.Text         = instance.legs_stir_s2;
            textBox_stir_spacing_1.Text = instance.spacing_stir_s1;
            textBox_stir_spacing_2.Text = instance.spacing_stir_s2;
            textBox_stir_angle_1.Text   = instance.angle_stir_s1;
            textBox_stir_angle_2.Text   = instance.angle_stir_s2;

            tabSLS_ConcreteStress = instance.tabSLS_ConcreteStress;
            tabSLS_SteelStress    = instance.tabSLS_SteelStress;
            tabVRd1         = instance.tabVRd1;
            tabVRdc1        = instance.tabVRdc1;
            tabSLS_NonCrack = instance.tabSLS_NonCrack;
            tabSLS_Crack    = instance.tabSLS_Crack;
            tab1_ULS        = instance.tab1_ULS;
            tab2_ULS        = instance.tab2_ULS;

            points_MN      = instance.points_MN;
            points_VN      = instance.points_VN;
            points_SLS_QPR = instance.points_SLS_QPR;
            points_SLS_CHR = instance.points_SLS_CHR;

            textBox_creep1.Text = instance.creep1.ToString();
            textBox_creep2.Text = instance.creep2.ToString();
        }