<OutputPath>$(SolutionDir)build\$(Configuration)</OutputPath>
<IntermediateOutputPath>$(SolutionDir)build\obj\$(Configuration)</IntermediateOutputPath>
<AssemblyOriginatorKeyFile>crow.key</AssemblyOriginatorKeyFile>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<EmbeddedResource Include="Icons\exit-symbol.svg" />
<EmbeddedResource Include="Icons\paste-on-document.svg" />
<EmbeddedResource Include="Icons\question.svg" />
+ <EmbeddedResource Include="Templates\FileDialog2.template">
+ <LogicalName>Crow.FileDialog2.template</LogicalName>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Icons\folder.svg" />
+ <EmbeddedResource Include="Icons\file.svg" />
+ <EmbeddedResource Include="Icons\level-up.svg" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" />
Height = 150;
}
FileDialog {
+ Template = #Crow.FileDialog.template;
Focusable = true;
MinimumSize=50,50;
Width = 500;
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve">
+<g>
+ <polygon fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" points="23,1 55,1 55,63 9,63 9,15 "/>
+ <polyline fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" points="9,15 23,15 23,1 "/>
+</g>
+</svg>
--- /dev/null
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
+ <defs>
+ <linearGradient id="0" x1="59.31" y1="-10.513" x2="59.15" y2="-37.783" gradientUnits="userSpaceOnUse" gradientTransform="matrix(4.17478 0 0 4.16765-1066.12 447.73)">
+ <stop stop-color="#e4c754"/>
+ <stop offset="1" stop-color="#ffe684"/>
+ </linearGradient>
+ <linearGradient gradientUnits="userSpaceOnUse" y2="354.29" x2="-704.05" y1="647.77" x1="-701.19" id="1">
+ <stop stop-color="#ffdd5a"/>
+ <stop offset="1" stop-color="#f4eca5"/>
+ </linearGradient>
+ </defs>
+ <path d="m-880.52 294.78c-4.626 0-8.349 3.718-8.349 8.335v161.41l88.94.193 372.09.807v-121.2c0-4.618-3.724-8.335-8.35-8.335h-265.48c-8.51.751-9.607-.377-13.812-5.981-5.964-7.968-14.969-21.443-20.84-29.21-4.712-6.805-5.477-6.02-13.292-6.02z" transform="matrix(.12614 0 0 .12614 115.04-27.788)" fill="url(#0)" color="#000"/>
+ <rect transform="matrix(.12614 0 0 .12614 115.04-27.788)" y="356.85" x="-890.28" height="295.13" width="463.85" fill="url(#1)" stroke="url(#1)" stroke-width="2.378" rx="9.63"/>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generated by IcoMoon.io -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
+<path fill="#FFFFFF" d="M9 0l4 7h-3v9h-7l2-3h2v-6h-3z"></path>
+</svg>
<?xml version="1.0"?>
-<Border Background="{./Background}" MinimumSize="50,20"
+<Border Background="{./Background}" MinimumSize="50,20" Name="Content"
Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
MouseEnter="{Foreground=vgradient|0:White|0.2:Gray|0.9:Gray|1:Black;caption.Foreground=White}"
MouseLeave="{Foreground=Transparent;caption.Foreground=LightGray}"
<ItemTemplate DataType="System.IO.FileInfo">
<HorizontalStack Focusable="true" Height="Fit" Width="Stretched" >
<Image Margin="2" Width="14" Height="14"
- Path="#Crow.Images.Icons.file.svg"/>
+ Path="#Crow.Icons.file.svg"/>
<Label Text="{Name}" Width="Stretched"
MouseEnter="{Background=vgradient|0:White|0.05:UnitedNationsBlue|1:Jet}"
MouseLeave="{Background=Transparent}"/>
SvgSub="{./IsExpanded}"/>
</Container>
<Image Margin="2" Width="14" Height="14"
- Path="#Crow.Images.Icons.folder.svg"/>
+ Path="#Crow.Icons.folder.svg"/>
<Label Text="{./Caption}"/>
</HorizontalStack>
<Container Name="Content" Visible="false"/>
<GraphicObject Width="5"/>
<Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
<Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Caption}" />
- <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
+ <Border CornerRadius="0" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
<Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
MouseClick="./butQuitPress"/>
</HorizontalStack>
<Container Name="Content" MinimumSize="50,50" Background="Onyx">
<VerticalStack Margin="1">
- <TextBox Text="{²./CurrentDirectory}"/>
- <HorizontalStack Spacing="1">
- <DirectoryView ShowFiles="false" Name="dv" CurrentDirectory="{²./CurrentDirectory}" Width="50%" Margin="0">
- <Template>
- <TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}"
- SelectedItemChanged="./onSelectedItemChanged">
- <ItemTemplate DataType="System.IO.FileInfo">
- <HorizontalStack Focusable="true" Height="Fit" Width="Stretched" Background="{../Background}" >
- <Image Margin="2" Width="14" Height="14"
- Path="#Crow.Images.Icons.file.svg"/>
- <Label Text="{Name}" Width="Stretched"
- MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
- MouseLeave="{Background=Transparent}"/>
- </HorizontalStack>
- </ItemTemplate>
- <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetDirectories">
- <Expandable Caption="{Name}" >
- <Template>
- <VerticalStack>
- <HorizontalStack Spacing="1" Height="Fit" MouseDoubleClick="./onClickForExpand"
- MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
- MouseLeave="{Background=Transparent}">
- <Container Margin="1" Width="10" Height="10" Focusable="true" MouseClick="./onClickForExpand"
- MouseEnter="{Background=LightGray}"
- MouseLeave="{Background=Transparent}">
- <Image
- Path="{./Image}"
- Visible="{./IsExpandable}"
- SvgSub="{./IsExpanded}"/>
- </Container>
- <Image Margin="2" Width="14" Height="14"
- Path="#Crow.Images.Icons.folder.svg"/>
- <Label Text="{./Caption}"/>
- </HorizontalStack>
- <Container Name="Content" Visible="false"/>
- </VerticalStack>
- </Template>
- <HorizontalStack Height="Fit">
- <GraphicObject Width="12" Height="10"/>
- <TreeView Name="List" Height="Fit"
- Template="#Crow.Templates.treeList.crow" />
- </HorizontalStack>
- </Expandable>
- </ItemTemplate>
- </TreeView>
- </Template>
- </DirectoryView>
- <Splitter/>
- <DirectoryView ShowFiles="true" Name="fv" CurrentDirectory="{../dv.SelectedItem}" SelectedItemChanged="./onSelectedItemChanged"
- Width="100%" Margin="0">
+ <HorizontalStack Height="Fit">
+ <Button Fit="true" Caption="Up" MouseClick="./goUpDirClick">
+ <Image Margin="2" Width="14" Height="14"
+ Path="#Crow.Icons.level-up.svg"/>
+ </Button>
+ <TextBox Text="{²./CurrentDirectory}"/>
+ </HorizontalStack>
+ <DirectoryView ShowFiles="true" Name="fv" CurrentDirectory="{./CurrentDirectory}" SelectedItemChanged="./onFVSelectedItemChanged"
+ Width="100%" Margin="0" MouseDoubleClick="./onFileSelect">
<Template>
<ListBox Name="fileView" Data="{./FileSystemEntries}" SelectedItemChanged="./onSelectedItemChanged">
<Template>
- <Border BorderWidth="1" Margin="0" MinimumSize="10,10">
- <VerticalStack>
- <Scroller ScrollX="{../scrollbar1.Value}" Name="scroller1"
- VerticalScrolling="False" HorizontalScrolling="true">
- <Wrapper Orientation="Horizontal" Width="Fit" HorizontalAlignment="Left"
- Name="ItemsContainer" Margin="0" Spacing="1"/>
- </Scroller>
- <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollX}"
- Maximum="{../scroller1.MaximumScroll}" Orientation="Horizontal"
- Height="14" />
- </VerticalStack>
- </Border>
+ <HorizontalStack>
+ <Scroller ScrollX="{../scrollbar1.Value}" Name="scroller1"
+ VerticalScrolling="true" HorizontalScrolling="false">
+ <VerticalStack Height="Fit" VerticalAlignment="Top"
+ Name="ItemsContainer" Margin="0" Spacing="1"/>
+ </Scroller>
+ <ScrollBar Name="scrollbar1" Value="{²../scroller1.ScrollY}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Vertical"
+ Width="14" />
+ </HorizontalStack>
</Template>
<ItemTemplate DataType="System.IO.FileInfo">
- <HorizontalStack Focusable="true" Height="Fit" >
- <Image Margin="2" Width="14" Height="14"
- Path="#Crow.Images.Icons.file.svg"/>
- <Label Text="{Name}"
- MouseEnter="{Background=BlueCrayola}"
- MouseLeave="{Background=Transparent}"/>
+ <HorizontalStack Focusable="true" Height="Fit">
+ <Image Margin="2" Width="16" Height="16"
+ Path="#Crow.Icons.file.svg"/>
+ <Label Text="{Name}" Width="Stretched"
+ MouseEnter="{Background=BlueCrayola}"
+ MouseLeave="{Background=Transparent}"/>
</HorizontalStack>
</ItemTemplate>
<ItemTemplate DataType="System.IO.DirectoryInfo">
- <HorizontalStack Focusable="true" Height="Fit" >
- <Image Margin="2" Width="14" Height="14"
- Path="#Crow.Images.Icons.folder.svg"/>
- <Label Text="{Name}"
- MouseEnter="{Background=BlueCrayola}"
- MouseLeave="{Background=Transparent}"/>
- </HorizontalStack>
+ <Border Foreground="Transparent" Focusable="true" Height="Fit">
+ <HorizontalStack
+ MouseEnter="{Background=BlueCrayola}"
+ MouseLeave="{Background=Transparent}">
+ <Image Margin="2" Width="16" Height="16"
+ Path="#Crow.Icons.folder.svg"/>
+ <Label Text="{Name}" Width="Stretched"/>
+ <Label Text="{LastAccessTime}" />
+ </HorizontalStack>
+ </Border>
</ItemTemplate>
</ListBox>
</Template>
</DirectoryView>
- </HorizontalStack>
- <TextBox Text="{./SelectedFile}"/>
+ <TextBox Text="{./SelectedDirectory}"/>
+ <TextBox Text="{²./SelectedFile}"/>
<HorizontalStack Fit="true" HorizontalAlignment="Right">
<Button Caption="Ok" MouseClick="./onFileSelect"/>
<Button Caption="Cancel" MouseClick="./onCancel"/>
--- /dev/null
+<?xml version="1.0"?>
+<Border BorderWidth="1" Foreground="White" CornerRadius="{./CornerRadius}"
+ Background="{./Background}"
+ MouseEnter="./onBorderMouseEnter"
+ MouseLeave="./onBorderMouseLeave">
+ <VerticalStack Spacing="0">
+ <HorizontalStack Background="vgradient|0:0.4,0.6,0.0,0.5|1:0.0,0.8,0.8,0.9"
+ Name="hs" Margin="2" Spacing="0" Height="Fit">
+ <GraphicObject Width="5"/>
+ <Image Margin="1" Width="12" Height="12" Path="{./Icon}"/>
+ <Label Width="Stretched" Foreground="White" Margin="1" TextAlignment="Center" Text="{./Caption}" />
+ <Border CornerRadius="6" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
+ MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+ <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
+ MouseClick="./butQuitPress"/>
+ </Border>
+ <GraphicObject Width="5"/>
+ </HorizontalStack>
+ <Container Name="Content" MinimumSize="50,50" Background="Onyx">
+ <VerticalStack Margin="1">
+ <HorizontalStack Height="Fit">
+ <Button Caption="Up" MouseClick="./goUpDirClick"/>
+ <TextBox Text="{²./CurrentDirectory}"/>
+ </HorizontalStack>
+ <HorizontalStack Spacing="1">
+ <DirectoryView ShowFiles="false" Name="dv" CurrentDirectory="{²./CurrentDirectory}" Width="50%" Margin="0"
+ SelectedItemChanged="./onFVSelectedItemChanged">
+ <Template>
+ <TreeView IsRoot="true" Name="treeView" Data="{./FileSystemEntries}"
+ SelectedItemChanged="./onSelectedItemChanged">
+ <ItemTemplate DataType="System.IO.FileInfo">
+ <HorizontalStack Focusable="true" Height="Fit" Width="Stretched" Background="{../Background}" >
+ <Image Margin="2" Width="14" Height="14"
+ Path="#Crow.Icons.file.svg"/>
+ <Label Text="{Name}" Width="Stretched"
+ MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+ MouseLeave="{Background=Transparent}"/>
+ </HorizontalStack>
+ </ItemTemplate>
+ <ItemTemplate DataType="System.IO.DirectoryInfo" Data="GetDirectories">
+ <Expandable Caption="{Name}" >
+ <Template>
+ <VerticalStack>
+ <HorizontalStack Spacing="1" Height="Fit" MouseDoubleClick="./onClickForExpand"
+ MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+ MouseLeave="{Background=Transparent}">
+ <Container Margin="1" Width="10" Height="10" Focusable="true" MouseClick="./onClickForExpand"
+ MouseEnter="{Background=LightGray}"
+ MouseLeave="{Background=Transparent}">
+ <Image
+ Path="{./Image}"
+ Visible="{./IsExpandable}"
+ SvgSub="{./IsExpanded}"/>
+ </Container>
+ <Image Margin="2" Width="14" Height="14"
+ Path="#Crow.Icons.folder.svg"/>
+ <Label Text="{./Caption}"/>
+ </HorizontalStack>
+ <Container Name="Content" Visible="false"/>
+ </VerticalStack>
+ </Template>
+ <HorizontalStack Height="Fit">
+ <GraphicObject Width="12" Height="10"/>
+ <TreeView Name="List" Height="Fit"
+ Template="#Crow.Templates.treeList.crow" />
+ </HorizontalStack>
+ </Expandable>
+ </ItemTemplate>
+ </TreeView>
+ </Template>
+ </DirectoryView>
+ <Splitter/>
+ <DirectoryView ShowFiles="true" Name="fv" CurrentDirectory="{./SelectedDirectory}" SelectedItemChanged="./onFVSelectedItemChanged"
+ Width="100%" Margin="0" MouseDoubleClick="./onFileSelect">
+ <Template>
+ <ListBox Name="fileView" Data="{./FileSystemEntries}" SelectedItemChanged="./onSelectedItemChanged">
+ <Template>
+ <VerticalStack>
+ <Scroller ScrollX="{../scrollbar1.Value}" Name="scroller1"
+ VerticalScrolling="False" HorizontalScrolling="true">
+ <Wrapper Orientation="Horizontal" Width="Fit" HorizontalAlignment="Left"
+ Name="ItemsContainer" Margin="0" Spacing="1"/>
+ </Scroller>
+ <ScrollBar Name="scrollbar1" Value="{../scroller1.ScrollX}"
+ Maximum="{../scroller1.MaximumScroll}" Orientation="Horizontal"
+ Height="14" />
+ </VerticalStack>
+ </Template>
+ <ItemTemplate DataType="System.IO.FileInfo">
+ <HorizontalStack Focusable="true" Height="Fit" >
+ <Image Margin="2" Width="14" Height="14"
+ Path="#Crow.Icons.file.svg"/>
+ <Label Text="{Name}"
+ MouseEnter="{Background=BlueCrayola}"
+ MouseLeave="{Background=Transparent}"/>
+ </HorizontalStack>
+ </ItemTemplate>
+ <ItemTemplate DataType="System.IO.DirectoryInfo">
+ <HorizontalStack Focusable="true" Height="Fit" >
+ <Image Margin="2" Width="14" Height="14"
+ Path="#Crow.Icons.folder.svg"/>
+ <Label Text="{Name}"
+ MouseEnter="{Background=BlueCrayola}"
+ MouseLeave="{Background=Transparent}"/>
+ </HorizontalStack>
+ </ItemTemplate>
+ </ListBox>
+ </Template>
+ </DirectoryView>
+ </HorizontalStack>
+ <TextBox Text="{./SelectedDirectory}"/>
+ <TextBox Text="{²./SelectedFile}"/>
+ <HorizontalStack Fit="true" HorizontalAlignment="Right">
+ <Button Caption="Ok" MouseClick="./onFileSelect"/>
+ <Button Caption="Cancel" MouseClick="./onCancel"/>
+ </HorizontalStack>
+ </VerticalStack>
+ </Container>
+ </VerticalStack>
+</Border>
string caption;
Picture icon;
- bool isEnabled;
+ bool canExecute = true;
#region Public properties
[XmlAttributeAttribute][DefaultValue(true)]
- public virtual bool IsEnabled {
- get { return isEnabled; }
+ public virtual bool CanExecute {
+ get { return canExecute; }
set {
- if (isEnabled == value)
+ if (canExecute == value)
return;
- isEnabled = value;
- NotifyValueChanged ("IsEnabled", isEnabled);
+ canExecute = value;
+ NotifyValueChanged ("CanExecute", canExecute);
}
}
[XmlAttributeAttribute][DefaultValue("Unamed Command")]
#endregion
public void Execute(){
- if (execute != null)
+ if (execute != null && CanExecute)
execute ();
}
internal void raiseAllValuesChanged(){
- NotifyValueChanged ("IsEnabled", isEnabled);
+ NotifyValueChanged ("CanExecute", canExecute);
NotifyValueChanged ("Icon", icon);
NotifyValueChanged ("Caption", caption);
}
{
public class FileDialog: Window
{
- string searchPattern, curDirectory;
+ string searchPattern, curDir, _selectedFile, _selectedDir;
#region events
public event EventHandler OkClicked;
[XmlAttributeAttribute][DefaultValue("/home")]
public virtual string CurrentDirectory {
- get { return curDirectory; }
+ get { return curDir; }
set {
- if (curDirectory == value)
+ if (curDir == value)
return;
- curDirectory = value;
- NotifyValueChanged ("CurrentDirectory", curDirectory);
-
+ curDir = value;
+ NotifyValueChanged ("CurrentDirectory", curDir);
+ SelectedDirectory = curDir;
}
}
- [XmlAttributeAttribute()][DefaultValue("*")]
+ [XmlAttributeAttribute][DefaultValue("*")]
public virtual string SearchPattern {
get { return searchPattern; }
set {
}
}
- string _selectedFile;
- [XmlIgnore]public string SelectedFile {
- get {
- return _selectedFile;
- }
+ [XmlAttributeAttribute]public string SelectedFile {
+ get { return _selectedFile; }
set {
if (value == _selectedFile)
return;
NotifyValueChanged ("SelectedFile", _selectedFile);
}
}
- public void onSelectedItemChanged (object sender, SelectionChangeEventArgs e){
+ [XmlAttributeAttribute]public string SelectedDirectory {
+ get { return _selectedDir; }
+ set {
+ if (value == _selectedDir)
+ return;
+ _selectedDir = value;
+ NotifyValueChanged ("SelectedDirectory", _selectedDir);
+ }
+ }
- string tmp = "";
+ public void onFVSelectedItemChanged (object sender, SelectionChangeEventArgs e){
+ if (e.NewValue != null) {
+ if (File.GetAttributes (e.NewValue.ToString ()).HasFlag (FileAttributes.Directory)) {
+ SelectedDirectory = e.NewValue.ToString ();
+ SelectedFile = "";
+ } else {
+ SelectedDirectory = Path.GetDirectoryName (e.NewValue.ToString ());
+ SelectedFile = Path.GetFileName (e.NewValue.ToString ());
+ }
+ }
+ }
+ public void onDVSelectedItemChanged (object sender, SelectionChangeEventArgs e){
if (e.NewValue != null)
- tmp = e.NewValue.ToString();
- if (tmp == SelectedFile)
+ SelectedDirectory = e.NewValue.ToString();
+ }
+ public void goUpDirClick (object sender, MouseButtonEventArgs e){
+ string root = Directory.GetDirectoryRoot(CurrentDirectory);
+ if (CurrentDirectory == root)
return;
- SelectedFile = tmp;
- //SelectedItemChanged.Raise (this, e);
+ CurrentDirectory = Directory.GetParent(CurrentDirectory).FullName;
}
void onFileSelect(object sender, MouseButtonEventArgs e){
- OkClicked.Raise (this, null);
- unloadDialog ((sender as GraphicObject).CurrentInterface);
+ if (string.IsNullOrEmpty (SelectedFile))
+ CurrentDirectory = SelectedDirectory;
+ else {
+ OkClicked.Raise (this, null);
+ unloadDialog ((sender as GraphicObject).CurrentInterface);
+ }
}
void onCancel(object sender, MouseButtonEventArgs e){
unloadDialog ((sender as GraphicObject).CurrentInterface);
#region Mouse handling
public virtual bool MouseIsIn(Point m)
{
- if (!(Visible & isEnabled))
- return false;
- if (ScreenCoordinates (Slot).ContainsOrIsEqual (m)) {
- Scroller scr = Parent as Scroller;
- if (scr == null) {
- if (Parent is GraphicObject)
- return (Parent as GraphicObject).MouseIsIn (m);
- else return true;
+ try {
+ if (!(Visible & isEnabled))
+ return false;
+ if (ScreenCoordinates (Slot).ContainsOrIsEqual (m)) {
+ Scroller scr = Parent as Scroller;
+ if (scr == null) {
+ if (Parent is GraphicObject)
+ return (Parent as GraphicObject).MouseIsIn (m);
+ else return true;
+ }
+ return scr.MouseIsIn (scr.savedMousePos);
}
- return scr.MouseIsIn (scr.savedMousePos);
+ } catch (Exception ex) {
+ return false;
}
return false;
}
}
public virtual void AddChild(GraphicObject g){
lock (children) {
- Children.Add (g);
g.Parent = this;
+ Children.Add (g);
}
g.RegisteredLayoutings = LayoutingType.None;
g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
}
#endregion
+ public event EventHandler<TextChangeEventArgs> TextChanged;
+
+ public virtual void OnTextChanged(Object sender, TextChangeEventArgs e)
+ {
+ NotifyValueChanged ("Text", Text);
+ TextChanged.Raise (this, e);
+ }
//TODO:change protected to private
#region private and protected fields
lines = getLines;
- NotifyValueChanged ("Text", _text);
+ OnTextChanged (this, new TextChangeEventArgs (Text));
RegisterForGraphicUpdate ();
}
}
CurrentColumn = lines [CurrentLine].Length;
lines [CurrentLine] += lines [CurrentLine + 1];
lines.RemoveAt (CurrentLine + 1);
- NotifyValueChanged ("Text", Text);
+
+ OnTextChanged (this, new TextChangeEventArgs (Text));
return;
}
CurrentColumn--;
SelBegin = -1;
SelRelease = -1;
}
- NotifyValueChanged ("Text", Text);
+ OnTextChanged (this, new TextChangeEventArgs (Text));
}
/// <summary>
/// Insert new string at caret position, should be sure no line break is inside.
lines [CurrentLine] = lines [CurrentLine].Insert (CurrentColumn, str);
CurrentColumn += str.Length;
}
- NotifyValueChanged ("Text", Text);
+ OnTextChanged (this, new TextChangeEventArgs (Text));
}
/// <summary>
/// Insert a line break.
lines [CurrentLine] = lines [CurrentLine].Substring (0, CurrentColumn);
CurrentLine++;
CurrentColumn = 0;
- NotifyValueChanged ("Text", Text);
+ OnTextChanged (this, new TextChangeEventArgs (Text));
}
#region GraphicObject overrides
}
}
[XmlAttributeAttribute]
+ public override bool IsEnabled {
+ get { return Command == null ? base.IsEnabled : Command.CanExecute; }
+ set { base.IsEnabled = value; }
+ }
+ [XmlAttributeAttribute]
public override string Caption {
get { return Command == null ? base.Caption : Command.Caption; }
set { base.Caption = value; }
void Command_ValueChanged (object sender, ValueChangeEventArgs e)
{
- NotifyValueChanged (e.MemberName, e.NewValue);
+ string mName = e.MemberName;
+ if (mName == "CanExecute")
+ mName = "IsEnabled";
+ NotifyValueChanged (mName, e.NewValue);
}
void onMI_Click (object sender, MouseButtonEventArgs e)
{
}
public override bool MouseIsIn (Point m)
{
- return base.MouseIsIn (m) || child.MouseIsIn (m);
+ return IsEnabled ? base.MouseIsIn (m) || child.MouseIsIn (m) : false;
}
public override void onMouseEnter (object sender, MouseMoveEventArgs e)
{
loadingThread = new CrowThread (this, loading);
loadingThread.Finished += (object sender, EventArgs e) => (sender as TemplatedGroup).Loaded.Raise (sender, e);
loadingThread.Start ();
- //loadPage(1);
NotifyValueChanged ("SelectedIndex", _selectedIndex);
NotifyValueChanged ("SelectedItem", SelectedItem);
FontExtents fe = gr.FontExtents;
}
#endregion
-
- public event EventHandler<TextChangeEventArgs> TextChanged;
-
- public virtual void OnTextChanged(Object sender, TextChangeEventArgs e)
- {
- TextChanged.Raise (this, e);
- }
#region Keyboard handling
public override void onKeyDown (object sender, KeyboardKeyEventArgs e)