public AdvancedSearch() { stockIcons = new StockIcons(); documentsStockIcon = stockIcons.DocumentAssociated; videosStockIcon = stockIcons.VideoFiles; musicStockIcon = stockIcons.AudioFiles; picturesStockIcon = stockIcons.ImageFiles; InitializeComponent(); // Set our default DocumentsRadioButton.IsChecked = true; // prop1prop2OperationComboBox.SelectedIndex = 0; // Because the search can take some time, using a background thread. // This timer will check if that thread is still alive and accordingly update // the cursor DispatcherTimer timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 1); timer.IsEnabled = true; timer.Tick += new EventHandler(timer_Tick); }
public Window1() { InitializeComponent(); // Initialize our default collection of StockIcons. // We will reuse this collection and only change certain properties as needed stockIcons = new StockIcons(); // Select large size comboBox1.SelectedIndex = 1; }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string filename = ""; if (args.Length > 0) filename = args[0]; Form1 f = new Form1(filename); StockIcons sicons = new StockIcons(); f.Icon = sicons.AudioFiles.Icon; Application.Run(f); }
public void StockIconsNotNull() { PropertyInfo[] infos = typeof(StockIcons).GetType().GetProperties(BindingFlags.Public); // BUG: This (StockIcons) doesn't follow the same pattern as most of the other factory style patterned classes? StockIcons icons = new StockIcons(); foreach (PropertyInfo info in infos) { if (info.PropertyType == typeof(StockIcon)) { Assert.DoesNotThrow(new Assert.ThrowsDelegate(() => { StockIcon test = (StockIcon)info.GetValue(icons, null); })); } } }
public void StockIconsContainedInAllCollection() { // TODO: Redesign test, this is a pretty redundant test with the way the class is designed. StockIcons icons = new StockIcons(); PropertyInfo[] infos = typeof(StockIcons).GetType().GetProperties(BindingFlags.Public); foreach (var info in infos) { if (info.PropertyType != typeof(StockIcon)) continue; StockIcon icon = null; try { //this will throw an exception if the icon does not exist on the system icon = (StockIcon)info.GetValue(icons, null); } catch { continue; } Assert.Contains<StockIcon>(icon, icons.AllStockIcons); } }