Ejemplo n.º 1
0
        public static void PreLoading()
        {
            string FileName = Application.StartupPath + "\\" + RdetOutboundAdapterConfigMgt.FileName;

            Log.WriteAppStart("RdetOutboundAdapter");

            //RdetOutboundAdapterConfigMgt.RdetOutAdapterConfig = RdetOutboundAdapterConfigMgt.BuildSampleConfig();
            //RdetOutboundAdapterConfigMgt.Save(FileName);

            if (!RdetOutboundAdapterConfigMgt.Load(FileName))
            {
                Log.Write(LogType.Error, "Load configuration failed. \r\n" + FileName + "\r\n" + RdetOutboundAdapterConfigMgt.LastException.Message);
            }
            Database           = new DataBase(RdetOutboundAdapterConfigMgt.RdetOutAdapterConfig.GWDataDBConnection);
            DeviceMgt          = new DeviceDirManager();
            DeviceMgt.FileName = Application.StartupPath + "\\" + DeviceDirManager.IndexFileName;
            if (DeviceMgt.LoadDeviceDir())
            {
                Log.Write("Load DeviceDir succeeded. " + DeviceMgt.FileName);
            }
            else
            {
                Log.Write(LogType.Error, "Load DeviceDir failed. " + DeviceMgt.FileName);
            }
        }
Ejemplo n.º 2
0
        public static void PreLoading()
        {
            string FileName = Application.StartupPath + "\\" + RdetOutboundAdapterConfigMgt.FileName;

            //RdetOutboundAdapterConfigMgt.RdetOutAdapterConfig = RdetOutboundAdapterConfigMgt.BuildSampleConfig();
            //RdetOutboundAdapterConfigMgt.Save(FileName);
            //LoadConfigXMLFile();

            if (!RdetOutboundAdapterConfigMgt.Load(FileName))
            {
                log.Write(LogType.Error, "Cannot Load Configuration file: " + FileName);
                if (MessageBox.Show("Cannot load configuration file. Do you want to create an empty configuration file?",
                                    "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    RdetOutboundAdapterConfigMgt.Save(FileName);
                }
            }
        }
Ejemplo n.º 3
0
        private void btBuildEmptyConfiguration_Click(object sender, EventArgs e)
        {
            string sConfigFile  = Application.StartupPath + "\\" + RdetOutboundAdapterConfigMgt.FileName;
            string sBakFileName = StarFile.BackupFile(sConfigFile);

            if (sBakFileName == "")
            {
                Program.Log.Write(LogType.Error, "Cannot backup configuration file:" + sConfigFile);
            }
            else
            {
                Program.Log.Write(LogType.Debug, "Configuration file:" + sConfigFile + " has been backup to " + sBakFileName);
            }

            RdetOutboundAdapterConfigMgt.RdetOutAdapterConfig = new RdetOutboundAdapterConfig();
            RdetOutboundAdapterConfigMgt.Save(sConfigFile);

            MessageBox.Show("New Configuration have been built!");
        }
Ejemplo n.º 4
0
        private void Save()
        {
            #region Server Rdet parameter
            clientRdetParams.LocalIP    = this.txtLocalIP.Text;
            clientRdetParams.LocalPort  = Int32.Parse(this.txtLocalPort.Text);
            clientRdetParams.ServerIP   = this.txtServerIP.Text;
            clientRdetParams.ServerPort = Int32.Parse(this.txtServerPort.Text);
            RdetOutboundAdapterConfigMgt.RdetOutAdapterConfig.OutGeneralParams.TimerInterval = Int32.Parse(this.txtInterval.Text);
            clientRdetParams.ConnectTimeout  = Int32.Parse(this.txtConnectTimeout.Text);
            clientRdetParams.ConnectTryCount = Int32.Parse(this.txtTryCount.Text);
            clientRdetParams.RecTimeout      = Int32.Parse(this.txtReceiveTimeout.Text);
            clientRdetParams.SendTimeout     = Int32.Parse(this.txtSendTimeout.Text);
            #endregion

            string FileName = Application.StartupPath + "\\" + RdetOutboundAdapterConfigMgt.FileName;
            if (!RdetOutboundAdapterConfigMgt.Save(FileName))
            {
                if (RdetOutboundAdapterConfigMgt.LastException != null)
                {
                    Program.log.Write(LogType.Error, "Cannot save information to configuration file: " + FileName);
                }
                MessageBox.Show(RdetOutboundAdapterConfigMgt.LastException.Message);
            }
        }