Inheritance: System.Windows.Controls.UserControl
Example #1
0
        public UserPage(
            LogoutDelegate logoutDelegate,
            string owner,
            string notificationsURL,
            SIPEntitiesDomainContext riaContext)
        {
            InitializeComponent();

            App.AppUnhandledException += new AppUnhandledExceptionDelegate(AppUnhandledException);

            Logout_External    = logoutDelegate;
            m_owner            = owner;
            m_notificationsURL = notificationsURL;

            this.TabNavigation = KeyboardNavigationMode.Cycle;

            Initialise(riaContext);

            // Get the customer record so the API key can be used to connect to the notifications service.
            riaContext.Load(riaContext.GetCustomerQuery(), LoadBehavior.RefreshCurrent, GetCustomerCompleted, riaContext);

            m_dialPlanManager            = new DialPlanManager(LogActivityMessage, m_owner, riaContext);
            m_dialPlanManager.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_dialPlanManager);

            m_sipAccountManager            = new SIPAccountManager(LogActivityMessage, m_owner, riaContext);
            m_sipAccountManager.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_sipAccountManager);

            m_sipProviderManager            = new SIPProviderManager(LogActivityMessage, m_owner, riaContext);
            m_sipProviderManager.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_sipProviderManager);

            m_sipCallsManager            = new SIPCallManager(LogActivityMessage, m_owner, riaContext);
            m_sipCallsManager.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_sipCallsManager);

            m_monitorConsole            = new MonitoringConsole(LogActivityMessage);
            m_monitorConsole.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_monitorConsole);

            m_customerSettings            = new CustomerSettingsControl(LogActivityMessage, Logout_External, m_owner, riaContext);
            m_customerSettings.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_customerSettings);

            SetActive(m_sipAccountManager);
            SetSelectedTextBlock(m_sipAccountsLink);
        }
        public UserPage(
            SIPSorceryPersistor persistor, 
            LogoutDelegate logoutDelegate, 
            string owner, 
            string authId, 
            string notificationsURL)
        {
            InitializeComponent();

            App.AppUnhandledException += new AppUnhandledExceptionDelegate(AppUnhandledException);

            m_persistor = persistor;
            //m_sipEventMonitorClient = sipEventMonitorClient;
            Logout_External = logoutDelegate;
            m_owner = owner;
            m_authId = authId;
            m_notificationsURL = notificationsURL;
            //m_monitorHost = monitorHost;
            //m_monitorPort = monitorPort;
            m_sessionTimer = new Timer(delegate { UIHelper.SetVisibility(m_extendSessionButton, Visibility.Visible); }, null, INITIAL_DISPLAY_EXTEND_SESSION, Timeout.Infinite);
            m_expiredTimer = new Timer(delegate { SessionExpired(); }, null, SUBSEQUENT_DISPLAY_EXTEND_SESSION, Timeout.Infinite);

            this.m_activityPorgressBar.Visibility = Visibility.Collapsed;
            this.TabNavigation = KeyboardNavigationMode.Cycle;
            this.m_extendSessionButton.Visibility = Visibility.Collapsed;
            m_persistor.ExtendSessionComplete += ExtendSessionComplete;
            m_persistor.IsAliveComplete += PersistorIsAliveComplete;

            m_sipNotifierClient = new SIPSorceryNotificationClient(LogActivityMessage, m_notificationsURL, m_authId);
            m_sipNotifierClient.StatusChanged += NotificationsServiceStatusChanged;
            m_sipNotifierClient.MachineEventReceived += SIPEventMonitorClient_MonitorEventReceived;

            //if (m_sipEventMonitorClient != null)
            //{
            //    m_sipEventMonitorClient.SocketDataReceived += new SocketDataReceivedDelegate(SIPEventMonitorClient_MonitorEventReceived);
            //    m_sipEventMonitorClient.SocketConnectionChange += new SocketConnectionChangeDelegate(SIPEventMonitorClient_MonitorConnectionChange);
            //}

            m_dialPlanManager = new DialPlanManager(LogActivityMessage, ShowActivityProgress, m_persistor, m_owner);
            m_dialPlanManager.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_dialPlanManager);

            m_sipAccountManager = new SIPAccountManager(LogActivityMessage, ShowActivityProgress, m_persistor, m_dialPlanManager.GetDialPlanNames, m_owner);
            m_sipAccountManager.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_sipAccountManager);

            m_sipProviderManager = new SIPProviderManager(LogActivityMessage, ShowActivityProgress, m_persistor, m_owner);
            m_sipProviderManager.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_sipProviderManager);

            m_sipCallsManager = new SIPCallManager(LogActivityMessage, ShowActivityProgress, m_persistor, m_owner);
            m_sipCallsManager.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_sipCallsManager);

            m_monitorConsole = new MonitoringConsole(LogActivityMessage, m_sipNotifierClient);
            m_monitorConsole.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_monitorConsole);

            m_customerSettings = new CustomerSettingsControl(LogActivityMessage, Logout_External, m_persistor, m_owner);
            m_customerSettings.Visibility = Visibility.Collapsed;
            m_mainCanvas.Children.Add(m_customerSettings);

            SetActive(m_sipAccountManager);
            SetSelectedTextBlock(m_sipAccountsLink);

            m_persistor.IsAliveAsync();
            m_sipNotifierClient.Connect();
        }