Beispiel #1
0
        void ButtonClear_Click(object sender, RoutedEventArgs e)
        {
            //Load Default Settings.
            IsolatedStorageManager.SetDefaultStorage(true);

            LoadSettingsFromIsolatedStorage();

            SystemMessages sm = new SystemMessages(new Message()
            {
                UserMessage = "Successfully Restored Default System Settings", SystemMessage = string.Empty, UserMessageType = MessageType.Success
            },
                                                   ButtonType.OkOnly);

            sm.Owner = Window.GetWindow(this);
            sm.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            sm.ShowPopup();
        }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            ((App)Application.Current).Principal = Thread.CurrentPrincipal;

            if (((App)Application.Current).Principal.IsInRole("Administrator"))
            {
                Nodes.Visibility = Security.Visibility = Visibility.Visible;
            }
            else
            {
                Nodes.Visibility = Security.Visibility = Visibility.Collapsed;
            }

            if (((App)Application.Current).Principal.IsInRole("Administrator, Editor"))
            {
                ConfigurationWizard.Visibility = Visibility.Visible;
                AddNew.Visibility         = Visibility.Visible;
                AddOtherDevice.Visibility = Visibility.Visible;
            }
            else
            {
                ConfigurationWizard.Visibility = Visibility.Collapsed;
                AddNew.Visibility         = Visibility.Collapsed;
                AddOtherDevice.Visibility = Visibility.Collapsed;
            }

            IsolatedStorageManager.SetDefaultStorage(false);

            if (UserControlSelectNode.ComboboxNode.Items.Count > 0)
            {
                HomePageUserControl home = new HomePageUserControl();
                ContentFrame.Navigate(home);
            }
            else
            {
                NodesUserControl nodesUserControl = new NodesUserControl();
                ContentFrame.Navigate(nodesUserControl);
            }

            TextBlockCurrentUser.Text     = "Current User: " + SecurityProviderCache.CurrentProvider.UserData.LoginID;
            CommonFunctions.s_currentUser = SecurityProviderCache.CurrentProvider.UserData.LoginID;
        }