Пример #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            try
            {
                SoftphoneEngine model = new SoftphoneEngine();
                MainWindow window = new MainWindow(model);
                window.Show();
            }
            catch (Exception ex)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("Could not initialize softphone: \r\n");
                sb.Append(ex.Message);
                sb.Append("\r\n");
                sb.Append(ex.InnerException);
                sb.Append(ex.StackTrace);
                MessageBox.Show(sb.ToString());
                Application.Current.Shutdown();
            }

            base.OnStartup(e);
        }
Пример #2
0
        public MainWindow(SoftphoneEngine model)
        {
            Model = model;

            KeepAliveValues = new List<KeepAliveMode>();
            var keelAliveValues = Enum.GetValues(typeof(KeepAliveMode));
            foreach (KeepAliveMode mode in keelAliveValues)
                KeepAliveValues.Add(mode);

            VideoQualities = new List<VideoQuality>();
            var qualities = Enum.GetValues(typeof(VideoQuality));
            foreach (VideoQuality quality in qualities)
                VideoQualities.Add(quality);
            VideoEncoderQuality = VideoQuality.High;

            InitializeComponent();

            CustomHeight = 550;

            Model.PhoneLineStateChanged += (Model_PhoneLineStateChanged);
            Model.PhoneCallStateChanged += (Model_PhoneCallStateChanged);
            Model.MediaHandlers.MicrophoneStopped += MediaHandlers_MicrophoneStopped;
            Model.MediaHandlers.SpeakerStopped += MediaHandlers_SpeakerStopped;
        }