Exemple #1
0
        public frmCallerId(AppSettings appsettings, string callerid)
        {
            InitializeComponent();
            this.optset = (LocalAppSettings)appsettings;
            Stream s   = this.GetType().Assembly.GetManifestResourceStream("AstCTIClient.callerid.gif");
            Bitmap bmp = new Bitmap(s);

            this.Region              = BitmapToRegion.Convert(bmp, bmp.GetPixel(0, 0), TransparencyMode.ColorKeyTransparent);
            this.Click              += new EventHandler(frmCallerId_Click);
            this.lblCallerId.Text    = callerid;
            this.lblCallerName.Text  = "";
            this.Speed               = 10;
            this.MouseEnter         += new EventHandler(frmCallerId_MouseEnter);
            this.MouseLeave         += new EventHandler(frmCallerId_MouseLeave);
            this.localizator         = new Localizator();
            this.localizator.Culture = this.optset.Language;
            this.localizator.Localize(this);
        }
Exemple #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();
        }