Ejemplo n.º 1
0
        public UserControl1(CaseObject caseObj)
        {
            m_CaseObj = caseObj;

            InitializeComponent();
            CultureResources.registerDataProvider(this);

            this.Loaded += new RoutedEventHandler(UserControl1_Loaded);

            InfoDisplayArea.DataContext = m_CaseObj;

            m_EventRecords = new List<CaseObject.CaseEventRecord>();

            listView2.DataContext = m_CaseObj.NewAttachments;            
            m_statusBarItems = new List<StatusBarItem>();                   

            TextBlock caseIdTextBlck = new TextBlock();

            // Bind the case id text to the resource file
            var binding = new Binding("CaseId_Colon");
            binding.Source = CultureResources.getDataProvider();
            BindingOperations.SetBinding(caseIdTextBlck, TextBlock.TextProperty, binding);

            TextBlock textBlck = new TextBlock();
            textBlck.Text = " " + m_CaseObj.CaseId;

            // Put the label and the text next side by side in a stack panel
            StackPanel stackPanel = new StackPanel();
            stackPanel.Orientation = Orientation.Horizontal;
            stackPanel.Children.Add(caseIdTextBlck);
            stackPanel.Children.Add(textBlck);

            StatusBarItem item = new StatusBarItem();            
            item.Content = stackPanel;
            item.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
            item.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
            m_statusBarItems.Add(item);

            CultureResources.getDataProvider().DataChanged += new EventHandler(CultureResources_DataChanged);

            if (caseObj.ResultsList == null || caseObj.ResultsList.Count == 0)
            {
                ResultsSectionBorder.Visibility = System.Windows.Visibility.Collapsed;
                ResultsView.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                foreach (result result in caseObj.ResultsList)
                {
                    ResultItem resultItem = new ResultItem(result);

                    ResultsView.Children.Add(resultItem);
                }
            }
        }
Ejemplo n.º 2
0
        public PrintPreview(CaseObject CaseObj/*, BitmapSource bitmapSource*/) :
            base()
        {
            InitializeComponent();
            CultureResources.registerDataProvider(this);

            MainDisplay.DataContext = CaseObj;

            PrintDate.Text = " " + CultureResources.ConvertDateTimeToStringForDisplay(DateTime.Now);

            foreach (result result in CaseObj.ResultsList)
            {
                ResultItem resultItem = new ResultItem(result);

                ResultsView.Children.Add(resultItem);
            }

            CultureResources.getDataProvider().DataChanged += new EventHandler(CultureResources_DataChanged);
            this.Unloaded += new System.Windows.RoutedEventHandler(PrintPreview_Unloaded);
        }