Beispiel #1
0
        private void Add_Company_Data_click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(txt_compname.Text) || String.IsNullOrEmpty(txt_compaddr.Text))
            {
                MessageBox.Show("Please enter company name and address", application_name);
            }
            else
            {
                string url_name_config = Folder_Path + "/DataConfig/config_name.txt";
                string comp_name       = txt_compname.Text;
                SensorHelper_2.writeTextFile(url_name_config, comp_name);

                string url_addr_config = Folder_Path + "/DataConfig/config_addr.txt";
                string comp_addr       = txt_compaddr.Text;
                SensorHelper_2.writeTextFile(url_addr_config, comp_addr);

                string url_logo_config = Folder_Path + "/DataConfig/Logo.png";

                string filepath = Label_Logo.Content.ToString(); // Stores Original Path in Textbox

                Uri resourceUri = new Uri(filepath, UriKind.RelativeOrAbsolute);

                if (!String.IsNullOrEmpty(filepath))
                {
                    ImageSource imgsource = new BitmapImage(new Uri(filepath));
                    File.Copy(filepath, url_logo_config, true);
                }
                MessageBox.Show("Company Data successfully saved", application_name);
            }
        }
        private void BtnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(txt_companyName.Text) || String.IsNullOrEmpty(txt_companyAddress.Text))
            {
                MessageBox.Show("Please enter company name and address", application_name);
            }
            else
            {
                string url_name_config = Folder_Path + "/DataConfig/config_name.txt";
                //string url_name_config = "D:/Sensor_data/DataConfig/config_name.txt";
                string comp_name = txt_companyName.Text;
                SensorHelper_2.writeTextFile(url_name_config, comp_name);
                //MessageBox.Show("Company name successfully saved", application_name);

                string url_addr_config = Folder_Path + "/DataConfig/config_addr.txt";
                //string url_addr_config = "D:/Sensor_data/DataConfig/config_addr.txt";
                string comp_addr = txt_companyAddress.Text;
                SensorHelper_2.writeTextFile(url_addr_config, comp_addr);
                //MessageBox.Show("Company address successfully saved", application_name);

                string url_logo_config = Folder_Path + "/DataConfig/Logo.png";
                //string url_logo_config_temp = Folder_Path + "/DataConfig/Logo_temp.png";


                string filepath = txt_companyLogo.Text; // Stores Original Path in Textbox

                Uri resourceUri = new Uri(filepath, UriKind.RelativeOrAbsolute);
                //((MainWindow)Application.Current.MainWindow).imgDynamic.Source = new BitmapImage(resourceUri);

                if (!String.IsNullOrEmpty(txt_companyLogo.Text))
                {
                    //File.Delete(url_logo_config);
                    ImageSource imgsource = new BitmapImage(new Uri(filepath));
                    File.Copy(filepath, url_logo_config, true);
                    //File.Copy(url_logo_config, url_logo_config_temp, true);
                }
                MessageBox.Show("Company Data successfully saved", application_name);
            }
        }