}
Button {
Caption = "Button";
+ MinimumSize = "50,20";
Width = "Fit";
}
Label {
<?xml version="1.0"?>
-<Border Background="{./Background}" MinimumSize="50,20" Name="Content"
+<Border Background="{./Background}" Name="Content"
Foreground="Transparent" CornerRadius="{../CornerRadius}" BorderWidth="1"
MouseEnter="{Foreground=vgradient|0:White|0.2:Grey|0.9:Grey|1:Black};{caption.Foreground=White}"
MouseLeave="{Foreground=Transparent};{caption.Foreground=LightGrey}"
<TextBox Style="TxtInFileDialog" Text="{²./CurrentDirectory}"/>
</HorizontalStack>
<DirectoryView ShowHidden="{²../cbShowHidden.IsChecked}" FileMask="{²../txtFileMask.Text}" ShowFiles="{²../cbShowFiles.IsChecked}" Name="fv" CurrentDirectory="{./CurrentDirectory}" SelectedItemChanged="./onFVSelectedItemChanged"
- Width="100%" Margin="0" MouseDoubleClick="./onFileSelect">
+ Width="100%" Margin="0" MouseDoubleClick="./onFileSelectDblClick">
<Template>
<ListBox ItemTemplate="#Crow.FileItems.template" Name="fileView" Data="{./FileSystemEntries}"
SelectedItemChanged="./onSelectedItemChanged">
#endregion
#region CTOR
+ public Command () {}
/// <summary>
/// Initializes a new instance of Command with the action pass as argument.
/// </summary>
if (!Directory.Exists (CROW_CONFIG_ROOT))
Directory.CreateDirectory (CROW_CONFIG_ROOT);
- //ensure all assemblies are loaded, because IML could contains classes not instanciated in source
- foreach (string af in Directory.GetFiles (AppDomain.CurrentDomain.BaseDirectory, "*.dll")) {
- try {
- Assembly a =Assembly.LoadFrom (af);
- if (a == Assembly.GetEntryAssembly () || a == Assembly.GetExecutingAssembly ())
- continue;
- if (a.GetCustomAttribute (typeof (CrowAttribute)) != null)
- crowAssemblies.Add (a);
- } catch {
- Debug.WriteLine ("{0} not loaded as assembly.", af);
- }
- }
-
FontRenderingOptions = new FontOptions ();
FontRenderingOptions.Antialias = Antialias.Subpixel;
FontRenderingOptions.HintMetrics = HintMetrics.On;
FontRenderingOptions.HintStyle = HintStyle.Full;
FontRenderingOptions.SubpixelOrder = SubpixelOrder.Default;
+
+ preloadCrowAssemblies ();
}
+ static void preloadCrowAssemblies () {
+ //ensure all assemblies are loaded, because IML could contains classes not instanciated in source
+ Assembly ea = Assembly.GetEntryAssembly ();
+ System.IO.FileStream[] files = ea.GetFiles ();
+ foreach (AssemblyName an in ea.GetReferencedAssemblies()) {
+ try {
+ Assembly a = Assembly.ReflectionOnlyLoad (an.Name);
+ if (a == Assembly.GetExecutingAssembly ())
+ continue;
+ if (a.GetCustomAttribute (typeof (CrowAttribute)) != null)
+ crowAssemblies.Add (a);
+ } catch {
+
+ }
+ }
+ }
+
public Interface (int width, int height, IntPtr glfwWindowHandle) : this (width, height, false, false)
{
hWin = glfwWindowHandle;
throw new PlatformNotSupportedException ("Unable to create cairo surface.");
}
}
+ internal Dictionary<string, MethodInfo> knownExtMethods = new Dictionary<string, MethodInfo> ();
+ internal MethodInfo SearchExtMethod (Type t, string methodName) {
+ string key = t.Name + "." + methodName;
+ if (knownExtMethods.ContainsKey (key))
+ return knownExtMethods [key];
+
+ //System.Diagnostics.Debug.WriteLine ($"*** search extension method: {t};{methodName} => key={key}");
+
+ MethodInfo mi = null;
+ if (!CompilerServices.TryGetExtensionMethods (Assembly.GetEntryAssembly (), t, methodName, out mi)) {
+ if (!CompilerServices.TryGetExtensionMethods (t.Module.Assembly, t, methodName, out mi)) {
+ foreach (Assembly a in crowAssemblies) {
+ if (CompilerServices.TryGetExtensionMethods (a, t, methodName, out mi))
+ break;
+ }
+ if (mi == null)
+ CompilerServices.TryGetExtensionMethods (Assembly.GetExecutingAssembly (), t, methodName, out mi);//crow Assembly
+ }
+ }
+
+ //add key even if mi is null to prevent searching again and again for propertyless bindings
+ knownExtMethods.Add (key, mi);
+ return mi;
+ }
#region events delegates
}
//data is on the stack
void emitGetSubData(ILGenerator il, Type dataType){
+ if (dataType.IsValueType)
+ il.Emit (OpCodes.Unbox_Any, dataType);
MethodInfo miGetDatas = dataType.GetMethod (fetchMethodName, new Type[] {});
if (miGetDatas == null)
- miGetDatas = CompilerServices.SearchExtMethod (dataType, fetchMethodName);
+ miGetDatas = iface.SearchExtMethod (dataType, fetchMethodName);
if (miGetDatas == null) {//in last resort, search among properties
PropertyInfo piDatas = dataType.GetProperty (fetchMethodName);
SelectedDirectory = e.NewValue.ToString();
}
public void goUpDirClick (object sender, MouseButtonEventArgs e){
- string root = Directory.GetDirectoryRoot(CurrentDirectory);
- DirectoryInfo parentDir = Directory.GetParent (CurrentDirectory);
- if (parentDir == null)
+ string root = Directory.GetDirectoryRoot(CurrentDirectory);
+ if (CurrentDirectory == root)
return;
- CurrentDirectory = parentDir.FullName;
+ CurrentDirectory = Directory.GetParent(CurrentDirectory).FullName;
}
- void onFileSelect(object sender, MouseButtonEventArgs e){
- if (string.IsNullOrEmpty (SelectedFile))
- CurrentDirectory = SelectedDirectory;
- else {
- OkClicked.Raise (this, null);
- IFace.DeleteWidget (this);
+ void onFileSelectDblClick (object sender, MouseButtonEventArgs e) {
+ CurrentDirectory = SelectedDirectory;
+ }
+
+ void onFileSelect (object sender, MouseButtonEventArgs e){
+ if (ShowFiles) {
+ if (string.IsNullOrEmpty (SelectedFile)) {
+ CurrentDirectory = SelectedDirectory;
+ return;
+ }
}
+ OkClicked.Raise (this, null);
+ IFace.DeleteWidget (this);
}
void onCancel(object sender, MouseButtonEventArgs e){
IFace.DeleteWidget (this);
}*/
}
- public override void Paint (ref Cairo.Context ctx)
+ public override void Paint (Cairo.Context ctx)
{
- base.Paint (ref ctx);
+ base.Paint (ctx);
Rectangle r = new Rectangle(mousePos.X, 0, 1, Slot.Height);
Rectangle ctxR = ContextCoordinates (r);
-<?xml version="1.0" encoding="UTF-8"?>
-<Window Caption="Showcase" Height="90%" Width="90%" Background="Jet">
+<?xml version="1.0" encoding="UTF-8"?>
+<Window Caption="Showcase" Height="90%" Width="90%" Background="DarkGrey">
<HorizontalStack>
<VerticalStack Width="30%" Margin="5">
<GroupBox Caption="Performance" Height="Fit">
</VerticalStack>
<Splitter />
<VerticalStack Width="50%">
- <RadioButton Style="CheckBox2" />
- <RadioButton Style="CheckBox2" />
- <RadioButton Style="CheckBox2" />
- <RadioButton Style="CheckBox2" />
+ <RadioButton Style="CheckBox2" Caption="RadioButton"/>
+ <RadioButton Style="CheckBox2" Caption="RadioButton"/>
+ <RadioButton Style="CheckBox2" Caption="RadioButton"/>
+ <RadioButton Style="CheckBox2" Caption="RadioButton"/>
</VerticalStack>
</HorizontalStack>
</GroupBox>