Пример #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 void Load()
        {
            SetUpdateButtonsEnabled(false);
            UIHelper.SetText(m_statusTextBlock, "Loading details, please wait...");

            m_riaContext.Customers.Clear();
            var query = m_riaContext.GetCustomerQuery();

            // Make sure the timezons are loaded first.
            if (Page.TimeZones == null)
            {
                m_riaContext.GetTimeZones(Page.GetTimeZonesCompleted, new Action(() => {
                    m_timezoneListBox.ItemsSource = Page.TimeZones;
                    m_riaContext.Load(query, LoadBehavior.RefreshCurrent, GetCustomerCompleted, null);
                }));
            }
            else
            {
                m_timezoneListBox.ItemsSource = Page.TimeZones;
                m_riaContext.Load(query, LoadBehavior.RefreshCurrent, GetCustomerCompleted, null);
            }
        }