Ejemplo n.º 1
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
#if TRACE
            long startTicks = VNC.AppLog.Trace5("Start", LOG_APPNAME);
#endif
            EyeOnLife.User_Interface.Helper.ValidateDataFullyLoaded();

            try
            {
                //System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["serversViewSource"];
                //// Things work if this line is present.  Testing to see if it works without 6/13/2012
                //// Yup, still works.  Don't need this line as it is done in the XAML.
                //myCollectionViewSource.Source = EyeOnLife.Common.ApplicationDataSet.Servers;

                //((CollectionViewSource)this.Resources["serversViewSource"]).Source = Common.ApplicationDataSet.Servers;

                ((CollectionViewSource)this.Resources["adDomains"]).Source     = Common.ApplicationDataSet.LKUP_ADDomains;
                ((CollectionViewSource)this.Resources["environments"]).Source  = Common.ApplicationDataSet.LKUP_Environments;
                ((CollectionViewSource)this.Resources["securityZones"]).Source = Common.ApplicationDataSet.LKUP_SecurityZones;

                //lg_BreadCrumb.DataContext = Common.ApplicationDataSet.Instances;

                lc_Root.DataContext      = Common.ApplicationDataSet.Instances;
                gc_Instances.ItemsSource = Common.ApplicationDataSet.Instances;

                // This line changes the Source of the serversInstancesViewSource.

                //((CollectionViewSource)this.Resources["instancesViewSource"]).Source = Common.ApplicationDataSet.Instances;

                //gc_Instances.ItemsSource = Common.ApplicationDataSet.Instances;
                //gc_Databases.ItemsSource = Common.ApplicationDataSet.Databases;

                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions2);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions3);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions4);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions5);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions6);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions7);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions8);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions9);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions10);

                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails1);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails2);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails3);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails4);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails5);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails6);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails7);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails8);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails9);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails10);

                ViewMode.AutoHideGroupVisibility(ahg_Left);
                ViewMode.AutoHideGroupVisibility(ahg_Top);
                ViewMode.AutoHideGroupVisibility(ahg_Right);
                ViewMode.AutoHideGroupVisibility(ahg_Bottom);

                var ckDisplayEnvironmentColumns = VNC.Xaml.PhysicalTree.FindChild <CheckBox>(cc_DisplayOptions2, "ckDisplayEnvironmentColumns");
                if (ckDisplayEnvironmentColumns != null)
                {
                    ((CheckBox)ckDisplayEnvironmentColumns).IsChecked = true;
                }

                var ckDisplayOperatingSystemColumns = VNC.Xaml.PhysicalTree.FindChild <CheckBox>(cc_DisplayOptions2, "ckDisplayOperatingSystemColumns");
                if (ckDisplayOperatingSystemColumns != null)
                {
                    ((CheckBox)ckDisplayOperatingSystemColumns).IsChecked = false;
                }

                //if (Common.UserMode == Common.UserModes.Basic)
                //{
                //    var adminOptions = VNC.Xaml.PhysicalTree.FindChild<WrapPanel>(cc_DisplayOptions_Instances, "AdminOptions");
                //    ((WrapPanel)adminOptions).Visibility = System.Windows.Visibility.Hidden;
                //}
                LogUsage(this.GetType());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
#if TRACE
            VNC.AppLog.Trace5("End", LOG_APPNAME, startTicks);
#endif
        }
        private void DXWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            try
            {
                //System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["serversViewSource"];
                //// Things work if this line is present.  Testing to see if it works without 6/13/2012
                //// Yup, still works.  Don't need this line as it is done in the XAML.
                //myCollectionViewSource.Source = EyeOnLife.Common.ApplicationDataSet.Servers;

                ((CollectionViewSource)this.Resources["serversViewSource"]).Source = Common.ApplicationDataSet.Servers;

                ((CollectionViewSource)this.Resources["adDomains"]).Source     = Common.ApplicationDataSet.LKUP_ADDomains;
                ((CollectionViewSource)this.Resources["environments"]).Source  = Common.ApplicationDataSet.LKUP_Environments;
                ((CollectionViewSource)this.Resources["securityZones"]).Source = Common.ApplicationDataSet.LKUP_SecurityZones;

                // This line changes the Source of the serversInstancesViewSource.

                ((CollectionViewSource)this.Resources["instancesViewSource"]).Source = Common.ApplicationDataSet.Instances;

                // Update the views.  First ensure a row is selected.

                tableView.FocusedRowHandle = 1;

                //serversGridControl.GroupBy("SecurityZone");

                //var ckDisplayEnvironmentColumns = DisplayOptions.VisualTreeHelperExtensions.FindAncestor<CheckBox>(cc_DisplayOptions_Instances);

                //var ckDisplayEnvironmentColumns = cc_DisplayOptions_Instances.FindName("ckDisplayEnvironmentColumns");

                var ckDisplayEnvironmentColumns = VisualTreeHelperExtensions.FindChild <CheckBox>(cc_DisplayOptions2, "ckDisplayEnvironmentColumns");
                ((CheckBox)ckDisplayEnvironmentColumns).IsChecked = true;

                //var ckDisplayOperatingSystemColumns = DisplayOptions.VisualTreeHelperExtensions.FindAncestor<CheckBox>(cc_DisplayOptions_Instances);
                var ckDisplayOperatingSystemColumns = VisualTreeHelperExtensions.FindChild <CheckBox>(cc_DisplayOptions2, "ckDisplayOperatingSystemColumns");
                ((CheckBox)ckDisplayOperatingSystemColumns).IsChecked = false;

                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions2);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions3);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions4);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions5);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions6);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions7);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions8);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions9);
                ViewMode.DisplayOptionsVisibility(cc_DisplayOptions10);

                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails1);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails2);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails3);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails4);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails5);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails6);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails7);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails8);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails9);
                ViewMode.SnapShotDetailsVisibility(lc_SnapShotDetails10);

                ViewMode.AutoHideGroupVisibility(ahg_Left);
                ViewMode.AutoHideGroupVisibility(ahg_Top);
                ViewMode.AutoHideGroupVisibility(ahg_Right);
                ViewMode.AutoHideGroupVisibility(ahg_Bottom);

                //if (Common.UserMode == Common.UserModes.Basic)
                //{
                //    var adminOptions = VisualTreeHelperExtensions.FindChild<WrapPanel>(cc_DisplayOptions_Instances, "AdminOptions");
                //    ((WrapPanel)adminOptions).Visibility = System.Windows.Visibility.Hidden;
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }