コード例 #1
0
 private void btnQuit_Click(object sender, EventArgs e)
 {
     try
     {
         this.sm.AppSettingsObject = optset;
         this.sm = null;
         this.Close();
     }
     catch (Exception) { }
 }
コード例 #2
0
        public frmMain()
        {
            InitializeComponent();
            Stream s   = this.GetType().Assembly.GetManifestResourceStream("AstCTIClient.mainform.gif");
            Bitmap bmp = new Bitmap(s);

            this.DoubleBuffered              = true;
            this.Region                      = BitmapToRegion.Convert(bmp, bmp.GetPixel(0, 0), TransparencyMode.ColorKeyTransparent);
            this.notifyIcon1.Visible         = false;
            this.MouseDown                  += new MouseEventHandler(frmMain_MouseDown);
            this.notifyIcon1.DoubleClick    += new EventHandler(notifyIcon1_DoubleClick);
            this.txtPassword.LostFocus      += new EventHandler(txtPassword_LostFocus);
            this.txtUsername.LostFocus      += new EventHandler(txtUsername_LostFocus);
            this.txtPhoneNumber.TextChanged += new EventHandler(txtPhoneNumber_TextChanged);
            this.cboOutboundContextes.SelectedIndexChanged += new EventHandler(cboOutboundContextes_SelectedIndexChanged);
            this.socketmanager     = null;
            this.parser            = null;
            this.protocolStatus    = PROTOCOL_STATES.STATUS_UNKNOWN;
            this.lblLineState.Text = "";
            sm = new SettingsManager.SettingsManager();
            this.CheckRegistrySettings();

            try
            {
                if (optset == null)
                {
                    sm.AppSettingsObject = new LocalAppSettings();
                    sm.ReadConfig();
                    optset = (LocalAppSettings)sm.AppSettingsObject;
                }

                if (this.parser == null)
                {
                    this.parser         = new ProtocolParser();
                    this.parser.Parsed += new ProtocolParser.OnParsed(parser_Parsed);
                }
                if (this.socketmanager == null)
                {
                    this.socketmanager               = new SocketManager(this.optset.Host, this.optset.Port);
                    this.socketmanager.Connected    += new SocketManager.OnConnected(socketmanager_Connected);
                    this.socketmanager.Disconnected += new SocketManager.OnDisconnected(socketmanager_Disconnected);
                    this.socketmanager.DataArrival  += new SocketManager.OnDataArrival(socketmanager_DataArrival);
                    this.socketmanager.SocketError  += new SocketManager.OnSocketError(socketmanager_SocketError);
                }
                this.noOpTimer          = new System.Windows.Forms.Timer();
                this.noOpTimer.Tick    += new EventHandler(noOpTimer_Tick);
                this.noOpTimer.Interval = this.optset.SocketTimeout;
                this.UpdateOutboundContextes();
                this.txtUsername.Text  = optset.Username;
                this.txtPassword.Text  = optset.Password;
                this.lblExtension.Text = optset.PhoneExt;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            this.localizator         = new Localizator();
            this.localizator.Culture = this.optset.Language;
            this.localizator.Localize(this);
            UpdateTooltips();
            this.FormSetFont();
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: happy-star/asterisk-cti
        public frmMain()
        {
            InitializeComponent();
            Stream s = this.GetType().Assembly.GetManifestResourceStream("AstCTIClient.mainform.gif");
            Bitmap bmp = new Bitmap(s);
            this.DoubleBuffered = true;
            this.Region = BitmapToRegion.Convert(bmp, bmp.GetPixel(0, 0), TransparencyMode.ColorKeyTransparent);
            this.notifyIcon1.Visible = false;
            this.MouseDown += new MouseEventHandler(frmMain_MouseDown);
            this.notifyIcon1.DoubleClick += new EventHandler(notifyIcon1_DoubleClick);
            this.txtPassword.LostFocus += new EventHandler(txtPassword_LostFocus);
            this.txtUsername.LostFocus += new EventHandler(txtUsername_LostFocus);
            this.txtPhoneNumber.TextChanged += new EventHandler(txtPhoneNumber_TextChanged);
            this.cboOutboundContextes.SelectedIndexChanged += new EventHandler(cboOutboundContextes_SelectedIndexChanged);
            this.socketmanager = null;
            this.parser = null;
            this.protocolStatus = PROTOCOL_STATES.STATUS_UNKNOWN;
            this.lblLineState.Text = "";
            sm = new SettingsManager.SettingsManager();
            this.CheckRegistrySettings();

            try
            {
                if (optset == null)
                {
                    sm.AppSettingsObject = new LocalAppSettings();
                    sm.ReadConfig();
                    optset = (LocalAppSettings)sm.AppSettingsObject;
                }

                if (this.parser == null)
                {
                    this.parser = new ProtocolParser();
                    this.parser.Parsed += new ProtocolParser.OnParsed(parser_Parsed);
                }
                if (this.socketmanager == null)
                {
                    this.socketmanager = new SocketManager(this.optset.Host, this.optset.Port);
                    this.socketmanager.Connected += new SocketManager.OnConnected(socketmanager_Connected);
                    this.socketmanager.Disconnected += new SocketManager.OnDisconnected(socketmanager_Disconnected);
                    this.socketmanager.DataArrival += new SocketManager.OnDataArrival(socketmanager_DataArrival);
                    this.socketmanager.SocketError += new SocketManager.OnSocketError(socketmanager_SocketError);
                }
                this.noOpTimer = new System.Windows.Forms.Timer();
                this.noOpTimer.Tick += new EventHandler(noOpTimer_Tick);
                this.noOpTimer.Interval = this.optset.SocketTimeout;
                this.UpdateOutboundContextes();
                this.txtUsername.Text = optset.Username;
                this.txtPassword.Text = optset.Password;
                this.lblExtension.Text = optset.PhoneExt;
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.ToString());
            }

            this.localizator = new Localizator();
            this.localizator.Culture = this.optset.Language;
            this.localizator.Localize(this);
            UpdateTooltips();
            this.FormSetFont();
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: happy-star/asterisk-cti
 private void btnQuit_Click(object sender, EventArgs e)
 {
     try
     {
         this.sm.AppSettingsObject = optset;
         this.sm = null;
         this.Close();
     }
     catch (Exception) { }
 }