|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: |
using System;
using System.IO;
namespace Wpf_SomethingFishy
{
public class FishBook
{
string name;
DateTime dateTime;
string size;
string path;
public FishBook(string filename)
{
FileInfo info = new FileInfo(filename);
size = (info.Length / 1024).ToString("N0") + " KB";
dateTime = info.LastWriteTime;
name = info.Name;
path = info.DirectoryName;
}
public string Name
{
get { return name; }
}
public DateTime DateTime
{
get { return dateTime; }
}
public string Size
{
get { return size; }
}
public string Path
{
get { return path; }
}
public string FullPath
{
get { return System.IO.Path.Combine(Path, Name); }
}
public override string ToString()
{
return FullPath;
}
}
}
using System;
using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Wpf_SomethingFishy
{
public class FishBooks : ObservableCollection<FishBook>
{
Dictionary<string, FileSystemWatcher> watchers = new Dictionary<string, FileSystemWatcher>();
public event EventHandler ItemsUpdated;
protected override void ClearItems()
{
base.ClearItems();
watchers.Clear();
}
protected override void InsertItem(int index, FishBook item)
{
base.InsertItem(index, item);
if (!watchers.ContainsKey(item.Path))
{
FileSystemWatcher watcher = new FileSystemWatcher(item.Path, "*.png");
watcher.EnableRaisingEvents = true;
watcher.Created += new System.IO.FileSystemEventHandler(OnPhotoCreated);
watcher.Deleted += new System.IO.FileSystemEventHandler(OnPhotoDeleted);
watchers.Add(item.Path, watcher);
}
}
void OnPhotoDeleted(object sender, System.IO.FileSystemEventArgs e)
{
int index = -1;
for (int i = 0; i < Items.Count; i++)
{
if (Items[i].FullPath == e.FullPath)
{
index = i;
break;
}
}
if (index >= 0)
Items.RemoveAt(index);
if (ItemsUpdated != null)
ItemsUpdated(this, new EventArgs());
}
void OnPhotoCreated(object sender, System.IO.FileSystemEventArgs e)
{
Items.Add(new FishBook(e.FullPath));
if (ItemsUpdated != null)
ItemsUpdated(this, new EventArgs());
}
}
}
<Window x:Class="Wpf_SomethingFishy.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:src="clr-namespace:Wpf_SomethingFishy"
Title="Under the Sea" Height="750" Width="590" WindowStyle="SingleBorderWindow" Background="Transparent">
<Window.Resources>
<src:FishBooks x:Key="FishBooksData"/>
<LinearGradientBrush x:Key="ButtonBrushOrange" StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0.45" Color="Orange" />
<GradientStop Offset="0.45" Color="Orange" />
<GradientStop Offset="0.6" Color="DarkOrange" />
<GradientStop Offset="0.9" Color="DarkOrange" />
</LinearGradientBrush>
<LinearGradientBrush x:Key="ButtonBrushBlack" StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0.45" Color="DarkSlateGray" />
<GradientStop Offset="0.45" Color="DarkSlateGray" />
<GradientStop Offset="0.6" Color="Black" />
<GradientStop Offset="0.9" Color="Black" />
</LinearGradientBrush>
<ControlTemplate x:Key="buttonControlTemplate">
<Grid Width="150" Height="Auto" >
<Ellipse x:Name="Disc" Width="125" Height="125" Fill="{StaticResource ButtonBrushBlack}"></Ellipse>
<Viewbox>
<ContentPresenter Margin="1" Content="{TemplateBinding Button.Content}"/>
</Viewbox>
</Grid>
</ControlTemplate>
<HierarchicalDataTemplate DataType="NavItems" ItemsSource="{Binding XPath=*}">
<StackPanel Orientation="Horizontal">
<Image Source="Fish\shiirafish.png" Height="42" Width="42" Margin="0,0,5,0"/>
<TextBlock Foreground="White" FontStyle="Normal" FontFamily="Calibri" FontSize="12" Text="{Binding XPath=@Header}"/>
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="NavItem" ItemsSource="{Binding XPath=*}">
<StackPanel Orientation="Horizontal">
<Image Source="Fish\babelfish.png" Height="42" Width="42" Margin="0,0,5,0"/>
<TextBlock Foreground="White" FontStyle="Normal" FontFamily="Calibri" FontSize="12" Text="{Binding XPath=@Type}"/>
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="NavItem1" ItemsSource="{Binding XPath=*}">
<StackPanel Orientation="Horizontal">
<Image Source="Fish\redFish.png" Height="42" Width="42" Margin="0,0,5,0"/>
<TextBlock Foreground="White" FontStyle="Normal" FontFamily="Calibri" FontSize="12" Text="{Binding XPath=@SubType}"/>
</StackPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="Fish" ItemsSource="{Binding XPath=*}">
<StackPanel Orientation="Horizontal">
<Image Source="Fish\fish-1.png" Height="42" Width="42" Margin="0,0,5,0"/>
<TextBlock Foreground="White" FontStyle="Normal" FontFamily="Calibri" FontSize="12" Text="{Binding XPath=Fish}"/>
</StackPanel>
</HierarchicalDataTemplate>
<XmlDataProvider x:Key="BlueDataProvider" XPath="NavItems" Source="BlueNavItems.xml" />
<Style TargetType="TreeViewItem">
<Setter Property="IsExpanded" Value="True" />
</Style>
</Window.Resources>
<Grid Background="{StaticResource ButtonBrushOrange}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="220"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" VerticalAlignment="Top" Height="155">
<WrapPanel HorizontalAlignment="Left" Grid.Column="0" >
<Button Template="{StaticResource buttonControlTemplate}" Click="btnGo_Click" >
<Image Source="Fish\diver.png" Height="9" Width="9" />
</Button>
</WrapPanel>
</StackPanel>
<StackPanel Margin="0,161,0,0" Grid.RowSpan="2">
<TreeView x:Name="treeViewBlue" Grid.Row="1" Foreground="Blue" Background="{StaticResource ButtonBrushOrange}" ItemsSource="{Binding Source={StaticResource BlueDataProvider}, XPath=.}" >
</TreeView>
</StackPanel>
<StackPanel Name="ListStackPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="0" Grid.RowSpan="2" Grid.Column="2" Grid.ColumnSpan="1" >
<ListBox x:Name="fishBox" BorderThickness="0" BorderBrush="Transparent" Grid.Row="0" Grid.RowSpan="2" Grid.Column="1"
ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ItemsSource="{Binding Source={StaticResource FishBooksData}}" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Background="Orange" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="55" />
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Image Source="{Binding Path=FullPath}" Height="35" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Grid>
</Window>
|
Advertisement
| Hall of Fame |