Example #1
0
 public MainWindow()
 {
     InitializeComponent();
     AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);
     queryPage    = new QueryPage(this);
     downloadPage = new DownloadPage(this);
     guiLogic     = new GUILogic();
     frame.NavigationService.Navigate(queryPage);
 }
Example #2
0
 internal SetupGUI(MainWindow mainWindow)
 {
     this.mainWindow  = mainWindow;
     queryPage        = mainWindow.queryPage;
     downloadPage     = mainWindow.downloadPage;
     localStudiesPage = mainWindow.localStudiesPage;
     localSeriesPage  = mainWindow.localSeriesPage;
     queryPage.executeQueryButton.Click += onButtonPressedHandler;
 }
Example #3
0
        public static void addMenuEntry(QueryObject response, BitmapImage image, DownloadPage downloadPageIstance)
        {
            GridView gridView = new GridView();

            downloadPageIstance.listView.View = gridView;

            List <dynamic> myItems = new List <dynamic>();
            dynamic        myItem;
            IDictionary <string, object> myItemValues;


            // Populate the objects with dynamic columns
            //  for (var i = 0; i < allResponses.Count;i++)
            //   {
            myItem = new System.Dynamic.ExpandoObject();

            if (response != null)
            {
                PropertyInfo[] p = response.GetType().GetProperties();
                for (int j = 0; j < p.Length; j++)
                {
                    myItemValues            = (IDictionary <string, object>)myItem;
                    myItemValues[p[j].Name] = p[j].GetValue(response);
                    //MessageBox.Show(p[j].GetValue(response).ToString());
                }
            }
            myItem.Icon = image;

            myItems.Add(myItem);

            //  }

            if (myItems.Count > 0)
            {
                // Assuming that all objects have same columns - using first item to determine the columns
                List <Column> columns = new List <Column>();

                myItemValues = (IDictionary <string, object>)myItems[0];

                // Key is the column, value is the value
                foreach (var pair in myItemValues)
                {
                    Column column = new Column();

                    column.Title       = pair.Key;
                    column.SourceField = pair.Key;

                    columns.Add(column);
                }

                // Add the column definitions to the list view
                gridView.Columns.Clear();

                foreach (var column in columns)
                {
                    if (column.SourceField == "Icon")
                    {
                        gridView.Columns.Add(new GridViewColumn
                        {
                            Header       = column.Title,
                            CellTemplate = downloadPageIstance.FindResource("iconTemplate") as DataTemplate
                        });
                    }
                    else
                    {
                        bool a       = (column.Title == "StudyInstanceUID" || column.Title == "SeriesInstanceUID");
                        int  testInt = a ? 0 : 1;

                        var binding = new Binding(column.SourceField);
                        gridView.Columns.Add(new GridViewColumn
                        {
                            Header = column.Title,
                            DisplayMemberBinding = binding,
                            Width = 100 * testInt
                        });
                    }
                }

                // Add all items to the list
                foreach (dynamic item in myItems)
                {
                    downloadPageIstance.listView.Items.Add(item);
                }
            }
        }