Ejemplo n.º 1
0
 /// <summary>
 /// Updates a list box's visibility.
 /// </summary>
 /// <param name="obj">The cascading list box.</param>
 /// <param name="args">Dependency Property Changed Event Args.</param>
 private static void ListVisibility_Changed(DependencyObject obj, DependencyPropertyChangedEventArgs args)
 {
     if (CascadingListBoxGroup.GetCascadingListBoxGroup(obj) != null)
     {
         CascadingListBoxGroup.GetCascadingListBoxGroup(obj).UpdateListVisibility(obj);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates a cascading list boxes visibility.
        /// </summary>
        /// <param name="item">The sliding list box.</param>
        internal void UpdateListVisibility(DependencyObject item)
        {
            ISplitItemsControl splitItemsControl = item as ISplitItemsControl;

            if (splitItemsControl != null && this.containersBySplitItemsControl.ContainsKey(splitItemsControl))
            {
                this.containersBySplitItemsControl[splitItemsControl].Visibility = CascadingListBoxGroup.GetListVisibility(item);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Override for clearing a container.
        /// </summary>
        /// <param name="element">The element dependency object.</param>
        /// <param name="item">The item object.</param>
        protected override void ClearContainerForItemOverride(DependencyObject element, object item)
        {
            base.ClearContainerForItemOverride(element, item);
            this.containersByItem.Remove(item);

            ISplitItemsControl splitItemsControl = item as ISplitItemsControl;

            if (splitItemsControl == null)
            {
                FrameworkElement frameworkElement = item as FrameworkElement;
                if (frameworkElement != null && !string.IsNullOrEmpty(CascadingListBoxGroup.GetCascadingListBoxName(frameworkElement)))
                {
                    splitItemsControl = frameworkElement.FindName(CascadingListBoxGroup.GetCascadingListBoxName(frameworkElement)) as ISplitItemsControl;
                }
            }

            if (splitItemsControl != null)
            {
                this.containersBySplitItemsControl.Remove(splitItemsControl);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Override for preparing the container.
        /// </summary>
        /// <param name="element">The element dependency object.</param>
        /// <param name="item">The item object.</param>
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            base.PrepareContainerForItemOverride(element, item);

            ContentPresenter container = element as ContentPresenter;

            this.containersByItem.Add(item, container);
            DependencyObject dependencyObject = item as DependencyObject;

            if (dependencyObject != null)
            {
                CascadingListBoxGroup.SetCascadingListBoxGroup(dependencyObject, this);
                LinkingWrapPanel.SetIsLinkedToNextChild(container, LinkingWrapPanel.GetIsLinkedToNextChild(dependencyObject));
                this.UpdateListVisibility(dependencyObject);
            }

#if SILVERLIGHT
            Canvas.SetZIndex(container, this.Items.Count - this.Items.IndexOf(item));
#endif
            ISplitItemsControl splitItemsControl = item as ISplitItemsControl;
            if (splitItemsControl == null)
            {
                FrameworkElement frameworkElement = item as FrameworkElement;

                if (frameworkElement != null && !string.IsNullOrEmpty(CascadingListBoxGroup.GetCascadingListBoxName(frameworkElement)))
                {
                    splitItemsControl = frameworkElement.FindName(CascadingListBoxGroup.GetCascadingListBoxName(frameworkElement)) as ISplitItemsControl;
                }
            }

            if (splitItemsControl != null)
            {
                CascadingListBoxGroup.SetCascadingListBoxGroup(splitItemsControl as DependencyObject, this);
                this.containersBySplitItemsControl.Add(splitItemsControl, container);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the template parts and adds event handlers.
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.conciseDrugsListContainer = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseDrugsListContainer) as FrameworkElement;
            this.cascadingListBoxGroup = this.GetTemplateChild(SearchAndPrescribeControl.ElementCascadingListBoxGroup) as CascadingListBoxGroup;
            if (this.cascadingListBoxGroup != null)
            {
                this.cascadingListBoxGroup.SizeChanged += new SizeChangedEventHandler(this.CascadingListBoxGroup_SizeChanged);
            }

            this.conciseDrugsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseDrugsList) as CascadingListBox;
            if (this.conciseDrugsList != null)
            {                
                this.conciseDrugsList.GotFocus += new RoutedEventHandler(this.ConciseList_GotFocus);
                this.conciseDrugsList.Expanded += new EventHandler(this.ConciseDrugsList_Expanded);
                this.conciseDrugsList.ConfirmedSelectedItemChanged += new EventHandler(this.CascadingConciseList_ConfirmedSelectedItemChanged);
                this.conciseDrugsList.ItemSelected += new EventHandler(this.ConciseDrugsList_ItemSelected);
                this.conciseDrugsList.KeyDown += new KeyEventHandler(this.CascadingConciseList_KeyDown);
                this.UpdateDrugResultsList(true);
            }

            this.conciseRoutesList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseRoutesList) as CascadingListBox;
            if (this.conciseRoutesList != null)
            {
                this.conciseRoutesList.GotFocus += new RoutedEventHandler(this.ConciseList_GotFocus);
                this.conciseRoutesList.Expanded += new EventHandler(this.CascadingConciseList_Expanded);
                this.conciseRoutesList.ConfirmedSelectedItemChanged += new EventHandler(this.CascadingConciseList_ConfirmedSelectedItemChanged);
                this.conciseRoutesList.ItemSelected += new EventHandler(this.ConciseRoutesList_ItemSelected);
                this.conciseRoutesList.OtherSelected += new EventHandler(this.ConciseRoutesList_OtherSelected);
                this.conciseRoutesList.KeyDown += new KeyEventHandler(this.CascadingConciseList_KeyDown);
            }

            this.conciseFormsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseFormsList) as CascadingListBox;
            if (this.conciseFormsList != null)
            {
                this.conciseFormsList.GotFocus += new RoutedEventHandler(this.ConciseList_GotFocus);
                this.conciseFormsList.Expanded += new EventHandler(this.CascadingConciseList_Expanded);
                this.conciseFormsList.ConfirmedSelectedItemChanged += new EventHandler(this.CascadingConciseList_ConfirmedSelectedItemChanged);
                this.conciseFormsList.ItemSelected += new EventHandler(this.ConciseFormsList_ItemSelected);
                this.conciseFormsList.KeyDown += new KeyEventHandler(this.CascadingConciseList_KeyDown);
            }

            this.conciseStrengthsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseStrengthsList) as SplitComboBox;
            if (this.conciseStrengthsList != null)
            {
                this.conciseStrengthsList.GotFocus += new RoutedEventHandler(this.ConciseList_GotFocus);
                this.conciseStrengthsList.ItemSelected += new EventHandler(this.ConciseStrengthsList_ItemSelected);
                this.conciseStrengthsList.OtherSelected += new EventHandler(this.ConciseStrengthsList_OtherSelected);
                CascadingListBoxGroup.SetListVisibility(this.conciseStrengthsList, Visibility.Collapsed);
            }

            this.conciseDosagesList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseDosagesList) as SplitComboBox;
            if (this.conciseDosagesList != null)
            {
                this.conciseDosagesList.GotFocus += new RoutedEventHandler(this.ConciseList_GotFocus);
                this.conciseDosagesList.ItemSelected += new EventHandler(this.ConciseDosagesList_ItemSelected);
                this.conciseDosagesList.OtherSelected += new EventHandler(this.ConciseDosagesList_OtherSelected);
                CascadingListBoxGroup.SetListVisibility(this.conciseDosagesList, Visibility.Collapsed);
            }

            this.conciseFrequenciesList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseFrequenciesList) as SplitComboBox;
            if (this.conciseFrequenciesList != null)
            {
                this.conciseFrequenciesList.GotFocus += new RoutedEventHandler(this.ConciseList_GotFocus);
                this.conciseFrequenciesList.ItemSelected += new EventHandler(this.ConciseFrequenciesList_ItemSelected);
                this.conciseFrequenciesList.OtherSelected += new EventHandler(this.ConciseFrequenciesList_OtherSelected);
                CascadingListBoxGroup.SetListVisibility(this.conciseFrequenciesList, Visibility.Collapsed);
            }

            this.conciseBrandsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseBrandsList) as SplitComboBox;
            if (this.conciseFrequenciesList != null)
            {
                this.conciseBrandsList.GotFocus += new RoutedEventHandler(this.ConciseList_GotFocus);
                CascadingListBoxGroup.SetListVisibility(this.conciseBrandsList, Visibility.Collapsed);
            }

            this.conciseTemplatePrescriptionsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseTemplatePrescriptionsList) as SplitComboBox;
            if (this.conciseTemplatePrescriptionsList != null)
            {
                this.conciseTemplatePrescriptionsList.GotFocus += new RoutedEventHandler(this.ConciseList_GotFocus);
                this.conciseTemplatePrescriptionsList.ItemsChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(this.ConciseTemplatePrescriptionsList_ItemsChanged);
                this.conciseTemplatePrescriptionsList.ItemSelected += new EventHandler(this.ConciseTemplatePrescriptionsList_ItemSelected);
                this.conciseTemplatePrescriptionsList.OtherSelected += new EventHandler(this.ConciseTemplatePrescriptionsList_OtherSelected);
            }

            this.conciseStartingConditionsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseStartingConditionsList) as SplitComboBox;
            if (this.conciseStartingConditionsList != null)
            {
                this.conciseStartingConditionsList.ItemSelected += new EventHandler(this.ConciseStartingConditionsList_ItemSelected);
            }

            SplitComboBox conciseAdministrationTimesList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseAdministrationTimesList) as SplitComboBox;
            if (conciseAdministrationTimesList != null)
            {
                conciseAdministrationTimesList.OtherSelected += new EventHandler(this.ConciseAdministrationTimesList_OtherSelected);
            }

            this.conciseDurationsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseDurationsList) as SplitComboBox;
            if (this.conciseDurationsList != null)
            {
                this.conciseDurationsList.OtherSelected += new EventHandler(this.ConciseDurationsList_OtherSelected);
            }

            this.drugSearchTextBox = this.GetTemplateChild(SearchAndPrescribeControl.ElementDrugSearchTextBox) as TextBox;
            if (this.drugSearchTextBox != null)
            {
#if SILVERLIGHT
                this.drugSearchTextBox.KeyDown += new KeyEventHandler(this.DrugSearchTextBox_KeyDown);
#else
                this.drugSearchTextBox.PreviewKeyDown += new KeyEventHandler(this.DrugSearchTextBox_KeyDown);
#endif

                if (this.focusDrugSearchTextBoxOnLoad)
                {
                    FocusHelper.FocusControl(this.drugSearchTextBox);
                    this.focusDrugSearchTextBoxOnLoad = false;
                }

                this.drugSearchTextBox.GotFocus += new RoutedEventHandler(this.DrugsList_GotFocus);
                this.drugSearchTextBox.LostFocus += new RoutedEventHandler(this.DrugsList_LostFocus);
            }

            this.drugSearchButton = this.GetTemplateChild(SearchAndPrescribeControl.ElementDrugSearchButton) as Button;
            if (this.drugSearchButton != null)
            {
                this.drugSearchButton.Click += new RoutedEventHandler(this.DrugSearchButton_Click);
                this.drugSearchButton.KeyDown += new KeyEventHandler(this.DrugSearchButton_KeyDown);
                this.drugSearchButton.GotFocus += new RoutedEventHandler(this.DrugsList_GotFocus);
                this.drugSearchButton.LostFocus += new RoutedEventHandler(this.DrugsList_LostFocus);
            }

            this.showAllDrugsButton = this.GetTemplateChild(SearchAndPrescribeControl.ElementShowAllDrugsButton) as Button;
            if (this.showAllDrugsButton != null)
            {
                this.showAllDrugsButton.Click += new RoutedEventHandler(this.ShowAllDrugsButton_Click);
                this.showAllDrugsButton.KeyDown += new KeyEventHandler(this.DrugsList_KeyDown);
                this.showAllDrugsButton.GotFocus += new RoutedEventHandler(this.DrugsList_GotFocus);
                this.showAllDrugsButton.LostFocus += new RoutedEventHandler(this.DrugsList_LostFocus);
            }

            UIElement backgroundElement = this.GetTemplateChild(SearchAndPrescribeControl.ElementBackgroundElement) as UIElement;
            if (backgroundElement != null)
            {
                backgroundElement.MouseLeftButtonDown += new MouseButtonEventHandler(this.BackgroundElement_MouseLeftButtonDown);
            }

            this.conciseDetailedViewToggleButton = this.GetTemplateChild(SearchAndPrescribeControl.ElementConciseDetailedViewToggleButton) as ToggleButton;
            if (this.conciseDetailedViewToggleButton != null)
            {
                this.conciseDetailedViewToggleButton.KeyDown += new KeyEventHandler(this.ConciseDetailedViewToggleButton_KeyDown);
            }

            this.detailedDrugRouteList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedDrugRouteList) as SplitComboBox;
            if (this.detailedDrugRouteList != null)
            {
                this.detailedDrugRouteList.OtherSelected += new EventHandler(this.DetailedDrugRouteList_OtherSelected);
            }

            this.unlicensedReasonTextBox = this.GetTemplateChild(SearchAndPrescribeControl.ElementUnlicensedReasonTextBox) as TextBox;

            this.detailedReasonForPrescribingOptionalFieldContainer = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedReasonForPrescribingOptionalFieldContainer) as OptionalFieldContainer;
            SplitComboBox detailedReasonForPrescribingList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedReasonForPrescribingList) as SplitComboBox;
            if (detailedReasonForPrescribingList != null)
            {
                detailedReasonForPrescribingList.OtherSelected += new EventHandler(this.DetailedReasonForPrescribingList_OtherSelected);
            }

            this.scrollViewer = this.GetTemplateChild(SearchAndPrescribeControl.ElementScrollViewer) as ScrollViewer;

            this.detailedStrengthsOptionalFieldContainer = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedStrengthsOptionalFieldContainer) as OptionalFieldContainer;
            this.detailedStrengthsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedStrengthsList) as SplitComboBox;
            if (this.detailedStrengthsList != null)
            {
                this.detailedStrengthsList.OtherSelected += new EventHandler(this.DetailedStrengthsList_OtherSelected);
            }

            this.detailedFormsOptionalFieldContainer = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedFormsOptionalFieldContainer) as OptionalFieldContainer;
            this.detailedFormsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedFormsList) as SplitComboBox;
            if (this.detailedFormsList != null)
            {
                this.detailedFormsList.OtherSelected += new EventHandler(this.DetailedFormsList_OtherSelected);
            }

            this.detailedDosagesList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedDosagesList) as SplitComboBox;
            this.detailedMethodTextBox = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedMethodTextBox) as TextBox;

            this.detailedSiteOptionalFieldContainer = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedSiteOptionalFieldContainer) as OptionalFieldContainer;
            this.detailedSitesList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedSitesList) as SplitComboBox;
            if (this.detailedSitesList != null)
            {
                this.detailedSitesList.OtherSelected += new EventHandler(this.DetailedSitesList_OtherSelected);
            }

            OptionalFieldContainer detailedAsRequiredOptionalFieldContainer = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedAsRequiredOptionFieldContainer) as OptionalFieldContainer;
            if (detailedAsRequiredOptionalFieldContainer != null)
            {
                detailedAsRequiredOptionalFieldContainer.Expanded += new EventHandler(this.DetailedAsRequiredOptionalFieldContainer_Expanded);
            }

            this.detailedFrequenciesList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedFrequenciesList) as SplitComboBox;
            this.detailedStartingConditionsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedStartingConditionsList) as SplitComboBox;

            SplitComboBox detailedAdministrationTimesList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedAdministrationTimesList) as SplitComboBox;
            if (detailedAdministrationTimesList != null)
            {
                detailedAdministrationTimesList.OtherSelected += new EventHandler(this.DetailedAdministrationTimesList_OtherSelected);
            }

            this.detailedDurationsList = this.GetTemplateChild(SearchAndPrescribeControl.ElementDetailedDurationsList) as SplitComboBox;

            this.previewButton = this.GetTemplateChild(SearchAndPrescribeControl.ElementPreviewButton) as Button;
            if (this.previewButton != null)
            {
                this.previewButton.Click += new RoutedEventHandler(this.PreviewButton_Click);
            }

            Button authorizeButton = this.GetTemplateChild(SearchAndPrescribeControl.ElementAuthorizeButton) as Button;
            if (authorizeButton != null)
            {
                authorizeButton.Click += new RoutedEventHandler(this.AuthorizeButton_Click);
            }

            this.closeButton = this.GetTemplateChild(SearchAndPrescribeControl.ElementCloseButton) as Button;
            if (this.closeButton != null)
            {
                this.closeButton.Click += new RoutedEventHandler(this.CloseButton_Click);
            }

            Border rootBorder = this.GetTemplateChild(SearchAndPrescribeControl.ElementRootBorder) as Border;
            if (rootBorder != null)
            {
                this.templatePrescriptionPromptWatermarkTemplate = rootBorder.Resources[SearchAndPrescribeControl.ElementTemplatePrescriptionPromptWatermarkTemplate] as DataTemplate;
                this.templatePrescriptionNoPromptWatermarkTemplate = rootBorder.Resources[SearchAndPrescribeControl.ElementTemplatePrescriptionNoPromptWatermarkTemplate] as DataTemplate;
            }

            this.RegisterIsFieldShowingChangedEvents(rootBorder);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets the cascading list box group.
 /// </summary>
 /// <param name="obj">The element.</param>
 /// <param name="value">The cascading list box group.</param>
 public static void SetCascadingListBoxGroup(DependencyObject obj, CascadingListBoxGroup value)
 {
     obj.SetValue(CascadingListBoxGroupProperty, value);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Sets the cascading list box group.
 /// </summary>
 /// <param name="obj">The element.</param>
 /// <param name="value">The cascading list box group.</param>
 public static void SetCascadingListBoxGroup(DependencyObject obj, CascadingListBoxGroup value)
 {
     obj.SetValue(CascadingListBoxGroupProperty, value);
 }