Пример #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            if (_core == null)
            {
                throw new NullReferenceException("Core is not initialized");
            }

            Ui.SetCurrent(this);

            Header = string.Format(_baseTitle, CaptionStrings.CaptionStrings.StateInitializing);

            _mainFormPhoneLineControls[0] = new MainFormPhoneLineControl(Core, 0, btnLine1, labelCallerIDName, txtNumber, lblDuration, labelCallState, btnHold);
            _mainFormPhoneLineControls[1] = new MainFormPhoneLineControl(Core, 1, btnLine2, labelCallerIDName, txtNumber, lblDuration, labelCallState, btnHold);
            _mainFormPhoneLineControls[2] = new MainFormPhoneLineControl(Core, 2, btnLine3, labelCallerIDName, txtNumber, lblDuration, labelCallState, btnHold);
            _mainFormPhoneLineControls[3] = new MainFormPhoneLineControl(Core, 3, btnLine4, labelCallerIDName, txtNumber, lblDuration, labelCallState, btnHold);
            _mainFormPhoneLineControls[4] = new MainFormPhoneLineControl(Core, 4, btnLine5, labelCallerIDName, txtNumber, lblDuration, labelCallState, btnHold);

            _mainFormPhoneLineControls[0].Active = true;
            _lastMainFormPhoneLineControl        = _mainFormPhoneLineControls[0];

            // Bind to audio subsystem
            LoadAudioValues();

            // UI features
            TopMost = _core.SettingsManager.GetValueOrSetDefault("mainFormTopMost", false);
            toolStripMenuItemTopAll.Checked = TopMost;
            Location = _core.SettingsManager.GetValueOrSetDefault("MainFormLocation", Location);

            // Load plugins ui elements
            ReloadUIElementsFromPlugins();

            AutoAnswerService.Create(_core);

            // Check if first run - run settings
            if (string.IsNullOrEmpty(_core.Sip.Account.UserName))
            {
                if (!DisableSettingsFormAutoStartup)
                {
                    kryptonCommandSettings.PerformExecute();
                }
            }
            else
            {
                // Connect
                _core.Sip.Account.Register();
            }

            labelCallState.Visible = false;
#if DEBUG
            labelCallState.Visible = true;
#endif

            _messageTransport.MessageReceived += OnRemoteMessageReceived;
        }
Пример #2
0
        public override void Start()
        {
            lock (_syncObject)
            {
                if (CallToolsOptions.OneLineService && !_oneLineInitialized)
                {
                    _oneLineInitialized = true;
                    _oneLine            = _oneLine ?? new OneLineService(this);
                }
                if (CallToolsOptions.OneLineService && this._oneLine != null)
                {
                    _oneLine.Start();
                    _uiElements.Add(new OneLinePluginUIElement(this, _oneLine));
                }

                if (CallToolsOptions.AutoAnswer && !_autoAnswerInitialized)
                {
                    _autoAnswerInitialized = true;
                    _autoAnswerService     = _autoAnswerService ?? new AutoAnswerService(this);
                }
                if (CallToolsOptions.AutoAnswer && this._autoAnswerService != null)
                {
                    this._autoAnswerService.Start();
                }

                if (CallToolsOptions.ShowIncomingCallWindow && !_incomingCallWindowInitialized)
                {
                    _incomingCallWindowInitialized = true;
                    _callNotifyWindowService       = _callNotifyWindowService ?? new CallNotifyWindowService(this);
                }
                if (CallToolsOptions.ShowIncomingCallWindow && this._callNotifyWindowService != null)
                {
                    _callNotifyWindowService.Start();
                }
            }

            if (CallToolsOptions.Pause)
            {
                _uiElements.Add(CallToolsOptions.PauseUiElementFactory(this));
            }

            _isStarted = true;
        }