public FormMain() { InitializeComponent(); AppConfig.Instance.LoadAppSetting( System.Configuration.ConfigurationManager.AppSettings["db"]); AppConfig.Instance.LoadGateSetting( int.Parse(System.Configuration.ConfigurationManager.AppSettings["gateid"])); useNetworkStorage = int.Parse(ConfigurationManager.AppSettings["use_remote_file"]) > 0 ? true : false; if (useNetworkStorage) { //open network share share_server = ConfigurationManager.AppSettings["remote_server"]; share_folder = ConfigurationManager.AppSettings["remote_share"]; share_user = ConfigurationManager.AppSettings["remote_user"]; share_password = ConfigurationManager.AppSettings["remote_password"]; share_path = ConfigurationManager.AppSettings["remote_folder"]; networkShare = new NetworkShare(); networkShare.LoginToShare(share_server, share_folder, share_user, share_password); if (share_path.Length > 0) imagePath = string.Format(@"\\{0}\{1}\{2}\", share_server, share_folder, share_path); else imagePath = string.Format(@"\\{0}\{1}\", share_server, share_folder); } else { imagePath = ConfigurationManager.AppSettings["local_image_dir"]; } }
public FormMain() { InitializeComponent(); timer.Start(); RFID_START_DELIM = Properties.Settings.Default.SerialStartChar; RFID_END_DELIM = Properties.Settings.Default.SerialEndChar; AppConfig.Instance.LoadAppSetting( ConfigurationManager.AppSettings["db"]); AppConfig.Instance.LoadGateSetting( int.Parse(ConfigurationManager.AppSettings["gateid"])); //check if using network share to store image string share = ConfigurationManager.AppSettings["use_network_share"]; useNetworkShare = int.Parse(share) > 0 ? true : false; if (useNetworkShare) { //open network share share_server = ConfigurationManager.AppSettings["remote_server"]; share_folder = ConfigurationManager.AppSettings["remote_share"]; share_user = ConfigurationManager.AppSettings["remote_user"]; share_password = ConfigurationManager.AppSettings["remote_password"]; share_path = ConfigurationManager.AppSettings["remote_folder"]; networkShare = new NetworkShare(); networkShare.LoginToShare(share_server, share_folder, share_user, share_password); if (share_path.Length > 0) imagePath = string.Format(@"\\{0}\{1}\{2}\", share_server, share_folder, share_path); else imagePath = string.Format(@"\\{0}\{1}\", share_server, share_folder); } else { imagePath = System.IO.Path.Combine(Application.StartupPath, "images"); if (!System.IO.Directory.Exists(imagePath)) { System.IO.Directory.CreateDirectory(imagePath); } } }