Pre-released Microsoft .NET Framework 3.0 Uninstall Tool
http://www.microsoft.com/downloads/details.aspx?FamilyId=AAE7FC63-D405-4E13-909F-E85AA9E66146&displaylang=en
.NET 3.0 Redistributable Package
http://www.microsoft.com/downloads/details.aspx?familyid=10CC340B-F857-4A14-83F5-25634C3BF043&displaylang=en
Microsoft® Windows® Software Development Kit for Windows Vista™ and .NET Framework 3.0 Runtime Components
http://www.microsoft.com/downloads/details.aspx?familyid=7614FE22-8A64-4DFB-AA0C-DB53035F40A0&displaylang=en
Microsoft® Visual Studio® 2005 Team Suite Service Pack 1
http://www.microsoft.com/downloads/details.aspx?familyid=BB4A75AB-E2D4-4C96-B39D-37BAF6B5B1DC&displaylang=en
Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF), November 2006 CTP
http://www.microsoft.com/downloads/details.aspx?familyid=f54f5537-cc86-4bf5-ae44-f5a1e805680d&displaylang=en
The Windows Vista Developer Story: Speech
http://msdn2.microsoft.com/en-us/library/aa480207.aspx
All the Cool Developers use Speech APIs
http://blogs.msdn.com/chuckop/archive/2006/11/24/microsoft-speech-api-sdk.aspx
SAPI 5.1 SDK
http://www.microsoft.com/speech/download/old/sapi5.asp
Sapi 5.1: clarifications there of
http://blindprogramming.com/pipermail/programming_blindprogramming.com/2006-February/004794.html
Install .NET Framework 3.0 June 2006 CTP from:
http://www.microsoft.com/downloads/details.aspx?FamilyId=8D09697E-4868-4D8D-A4CF-9B82A2AE542D&displaylang=en
Install Windows SDK June for CTP of .NET Framework 3.0 Runtime Components from:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9221A6AA-AC1C-4604-A326-B8CF2B12B6EB&displaylang=en
Install Microsoft Visual Studio Code Name "Orcas" CTP Development Tools for .NET Framework 3.0 from:
http://www.microsoft.com/downloads/details.aspx?FamilyId=1A994549-94CB-4F61-903D-A8C8E453EEF4&displaylang=en
Install Windows Imaging Components (WIC) from:
http://go.microsoft.com/fwlink/?LinkID=69301&clcid=0x409
Friday, March 16, 2007
Thursday, March 8, 2007
Updating UI from non-UI thread
In .NET 2.0:
In .NET 3.0:
http://www.codeproject.com/KB/cpp/SyncContextTutorial.aspx
void vj_engine_VowelGenerated(PatternDataCLR patternData)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new VJEngineCLR_vowelGenerated(vj_engine_VowelGenerated), new object[] { patternData });
return;
}
}
In .NET 3.0:
http://www.codeproject.com/KB/cpp/SyncContextTutorial.aspx
using System.ComponentModel;
...
namespace MyNamespace
{
...
public class MyClass
{
AsyncOperation operation;
...
public MyClass()
{
operation = AsyncOperationManager.CreateOperation(null);
...
}
void nonUIThreadEvent(...)
{
operation.Post(new System.Threading.SendOrPostCallback(delegate(object state)
{
// do something
}), null);
}
}
}
How to enable code syntax highlighting in Blogger
How-to:
http://blog.the-dargans.co.uk/2007/01/syntax-highlighting-in-blogger.html
C# code formatter:
http://www.manoli.net/csharpformat/
Span class tags to use inside
http://blog.the-dargans.co.uk/2007/01/syntax-highlighting-in-blogger.html
C# code formatter:
http://www.manoli.net/csharpformat/
Span class tags to use inside
<pre class="csharpcode">...</pre> tags:
<span class="kwrd">kwrd</span>
<span class="rem">rem</span>
<span class="str">str</span>
<span class="class">class</span>
<span class="op">op</span>
<span class="preproc">preproc</span>
<span class="asp">asp</span>
<span class="html">html</span>
<span class="attr">attr</span>
<span class="alt">alt</span>
<span class="lnum">lnum</span>
Tuesday, February 27, 2007
WPF references
MSDN documentation
http://msdn2.microsoft.com/en-us/library/ms754130.aspx
WPF Samples in MSDN:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/wpf_samples/html/b7781121-4c27-4814-a8d8-e6e0be247c00.htm
WPF Sample files part of Windows SDK:
C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\WPFSamples.zip
Location of WPF samples:
http://blogs.msdn.com/wpfsdk/attachment/1495353.ashx
Using Templates to Customize WPF Controls
http://msdn.microsoft.com/msdnmag/issues/07/01/Foundations/
In here, you can also find DumpControlTemplate code from Chapter 25 that allows you to dump out a control's default template property.
Custom TreeView Layout in WPF
http://www.codeproject.com/useritems/CustomTreeViewLayout.asp
Advanced Custom TreeView Layout in WPF
http://www.codeproject.com/WPF/AdvancedCustomTreeViewLyt.asp
Dependency property syntax:
// dependency property for minimum number of pies
public int MinNumPies
{
get { return (int)GetValue(MinNumPiesProperty); }
set { SetValue(MinNumPiesProperty, value); }
}
public static readonly DependencyProperty MinNumPiesProperty =
DependencyProperty.Register("MinNumPies", typeof(int), typeof(RadialPanel));
Routed events syntax:
MSDN documentation
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/wpf_conceptual/html/1a2189ae-13b4-45b0-b12c-8de2e49c29d2.htm
// routed event
public static readonly RoutedEvent EventNameEvent = EventManager.RegisterRoutedEvent("EventName",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyEnclosingClass));
// A .NET event wrapper (optional)
public event RoutedEventHandler EventName
{
add { AddHandler(EventNameEvent, value); }
remove { RemoveHandler(EventNameEvent, value); }
}
{
...
RaiseEvent(new RoutedEventArgs(EventNameEvent, this));
...
}
Binding syntax:
FAQ on Binding from MSDN blog:
http://blogs.msdn.com/wpfsdk/archive/2006/10/19/wpf-basic-data-binding-faq.aspx
NOTE: Can’t seem to nest bindings, e.g. {Binding Source={Binding Source={StaticResource resourceName}}}
NOTE: Target property (i.e. the left-hand side of {Binding...} must be a dependency property.
NOTE: When the source property is not a dependency property, the target property won’t be updated as the source property changes. To get them to be synchronized, the source object needs to either 1) implement the System.ComponentModel.INotifyPropertyChanged interface which has the single PropertyChanged event, or 2) implement an XXXChanged event, where XXX is the name of the property whose value changed. (first approach is recommended)
// ElementName used to refer to a XAML element defined by x:Name and source property on that object accessed through property1.property2
{Binding ElementName=elementName, Path=property1.property2}
{Binding property1.property2, ElementName=elementName}
// ElementName used to refer to a XAML element defined by x:Name
{Binding ElementName=elementName}
// Source used to refer to data source defined in ResourceDictionary and source property on that object accessed through property1.property2
{Binding Source={StaticResource resourceName}, Path=property1.property2}
// Source used to refer to data source defined in ResourceDictionary
{Binding Source={StaticResource resourceName}}
// when used within a FrameworkElement/FrameworkContentElement that have the DataContext property set to some data source, all nested Binding references implicitly assume a Source property value equal to that DataContext
<StackPanel DataContext={StaticResource resourceName}>
<Label Content={Binding Path=property}/>
<ListBox ItemsSource={Binding}/>
</StackPanel>
// when used within a DataTemplate, the DataContext is automatically set to the appropriate Source object, i.e. for ItemTemplate, it’s the current item
<ListBox>
<ListBox.ItemTemplate>
<Image Source=“{Binding Path=property}”/>
</ListBox.ItemTemplate>
</ListBox>
Binding’s RelativeSource property syntax:
RelativeSource property of Binding can be used to refer to data source relative to the target element
// source element equals target element
<Binding RelativeSource={RelativeSource Self}>
// source element equals target element’s TemplatedParent, which is essentially the target element of the template
<Binding RelativeSource={RelativeSource TemplatedParent}>
// source element equals the closest parent of a given type
<Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type desiredType}}>
// source element equals the nth closest parent of a given type
<Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=n, AncestorType={x:Type desiredType}}>
// source element equals the previous data item in a data-bound collection
<Binding RelativeSource={RelativeSource PreviousData}}>
TemplateBinding syntax:
Data source for TemplateBinding is always the target element, and the path is any of its dependency properties.
TemplateBinding can’t be used outside of a template’s VisualTree property, so can’t use in a trigger. Instead, you can use {Binding RelativeSource={RelativeSource TemplatedParent}}
<ControlTemplate TargetType=“{x:Type Button}”>
<!-- following bindings are all the same -->
<TextBlock Text=“{TemplateBinding Property=Button.Content}”/>
<TextBlock Text=“{TemplateBinding Button.Content}”/>
<TextBlock Text=“{TemplateBinding Content}”/>
</ControlTemplate>
ValueConverter syntax:
<Application.Resources>
<local:SingleConverter x:Key=“converter1”/>
<local:MultiConverter x:Key=“converter2”/>
</Application.Resources>
// single binding
<Label Background=“{Binding Source={StaticResource source}, Path=property, Converter={StaticResource converter1}, ConverterParameter=parameter}”/>
public class SingleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
...
}
}
// multibinding
<ProgressBar ...>
<ProgressBar.Value>
<MultiBinding Converter=“{StaticResource converter2}, ConverterParameter=parameter”>
<Binding ...}”/>
<Binding ...}”/>
<Binding ...}”/>
</MultiBinding>
</ProgressBar.Value>
</ProgressBar>
public class MultiConverter : IMultiConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
object value1 = values[0];
object value2 = values[1];
...
}
}
http://msdn2.microsoft.com/en-us/library/ms754130.aspx
WPF Samples in MSDN:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/wpf_samples/html/b7781121-4c27-4814-a8d8-e6e0be247c00.htm
WPF Sample files part of Windows SDK:
C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\WPFSamples.zip
Location of WPF samples:
http://blogs.msdn.com/wpfsdk/attachment/1495353.ashx
Using Templates to Customize WPF Controls
http://msdn.microsoft.com/msdnmag/issues/07/01/Foundations/
In here, you can also find DumpControlTemplate code from Chapter 25 that allows you to dump out a control's default template property.
Custom TreeView Layout in WPF
http://www.codeproject.com/useritems/CustomTreeViewLayout.asp
Advanced Custom TreeView Layout in WPF
http://www.codeproject.com/WPF/AdvancedCustomTreeViewLyt.asp
Dependency property syntax:
// dependency property for minimum number of pies
public int MinNumPies
{
get { return (int)GetValue(MinNumPiesProperty); }
set { SetValue(MinNumPiesProperty, value); }
}
public static readonly DependencyProperty MinNumPiesProperty =
DependencyProperty.Register("MinNumPies", typeof(int), typeof(RadialPanel));
Routed events syntax:
MSDN documentation
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/wpf_conceptual/html/1a2189ae-13b4-45b0-b12c-8de2e49c29d2.htm
// routed event
public static readonly RoutedEvent EventNameEvent = EventManager.RegisterRoutedEvent("EventName",
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyEnclosingClass));
// A .NET event wrapper (optional)
public event RoutedEventHandler EventName
{
add { AddHandler(EventNameEvent, value); }
remove { RemoveHandler(EventNameEvent, value); }
}
{
...
RaiseEvent(new RoutedEventArgs(EventNameEvent, this));
...
}
Binding syntax:
FAQ on Binding from MSDN blog:
http://blogs.msdn.com/wpfsdk/archive/2006/10/19/wpf-basic-data-binding-faq.aspx
NOTE: Can’t seem to nest bindings, e.g. {Binding Source={Binding Source={StaticResource resourceName}}}
NOTE: Target property (i.e. the left-hand side of {Binding...} must be a dependency property.
NOTE: When the source property is not a dependency property, the target property won’t be updated as the source property changes. To get them to be synchronized, the source object needs to either 1) implement the System.ComponentModel.INotifyPropertyChanged interface which has the single PropertyChanged event, or 2) implement an XXXChanged event, where XXX is the name of the property whose value changed. (first approach is recommended)
// ElementName used to refer to a XAML element defined by x:Name and source property on that object accessed through property1.property2
{Binding ElementName=elementName, Path=property1.property2}
{Binding property1.property2, ElementName=elementName}
// ElementName used to refer to a XAML element defined by x:Name
{Binding ElementName=elementName}
// Source used to refer to data source defined in ResourceDictionary and source property on that object accessed through property1.property2
{Binding Source={StaticResource resourceName}, Path=property1.property2}
// Source used to refer to data source defined in ResourceDictionary
{Binding Source={StaticResource resourceName}}
// when used within a FrameworkElement/FrameworkContentElement that have the DataContext property set to some data source, all nested Binding references implicitly assume a Source property value equal to that DataContext
<StackPanel DataContext={StaticResource resourceName}>
<Label Content={Binding Path=property}/>
<ListBox ItemsSource={Binding}/>
</StackPanel>
// when used within a DataTemplate, the DataContext is automatically set to the appropriate Source object, i.e. for ItemTemplate, it’s the current item
<ListBox>
<ListBox.ItemTemplate>
<Image Source=“{Binding Path=property}”/>
</ListBox.ItemTemplate>
</ListBox>
Binding’s RelativeSource property syntax:
RelativeSource property of Binding can be used to refer to data source relative to the target element
// source element equals target element
<Binding RelativeSource={RelativeSource Self}>
// source element equals target element’s TemplatedParent, which is essentially the target element of the template
<Binding RelativeSource={RelativeSource TemplatedParent}>
// source element equals the closest parent of a given type
<Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type desiredType}}>
// source element equals the nth closest parent of a given type
<Binding RelativeSource={RelativeSource FindAncestor, AncestorLevel=n, AncestorType={x:Type desiredType}}>
// source element equals the previous data item in a data-bound collection
<Binding RelativeSource={RelativeSource PreviousData}}>
TemplateBinding syntax:
Data source for TemplateBinding is always the target element, and the path is any of its dependency properties.
TemplateBinding can’t be used outside of a template’s VisualTree property, so can’t use in a trigger. Instead, you can use {Binding RelativeSource={RelativeSource TemplatedParent}}
<ControlTemplate TargetType=“{x:Type Button}”>
<!-- following bindings are all the same -->
<TextBlock Text=“{TemplateBinding Property=Button.Content}”/>
<TextBlock Text=“{TemplateBinding Button.Content}”/>
<TextBlock Text=“{TemplateBinding Content}”/>
</ControlTemplate>
ValueConverter syntax:
<Application.Resources>
<local:SingleConverter x:Key=“converter1”/>
<local:MultiConverter x:Key=“converter2”/>
</Application.Resources>
// single binding
<Label Background=“{Binding Source={StaticResource source}, Path=property, Converter={StaticResource converter1}, ConverterParameter=parameter}”/>
public class SingleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
...
}
}
// multibinding
<ProgressBar ...>
<ProgressBar.Value>
<MultiBinding Converter=“{StaticResource converter2}, ConverterParameter=parameter”>
<Binding ...}”/>
<Binding ...}”/>
<Binding ...}”/>
</MultiBinding>
</ProgressBar.Value>
</ProgressBar>
public class MultiConverter : IMultiConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
object value1 = values[0];
object value2 = values[1];
...
}
}
dev notes
Philip Martin Chavez, drawing using DNS and Paint
http://evoiceart.com/
Philip Martin Chavez
1261 Hopkins Street
Berkeley, CA 94702
510 524-6043
JettChair@aol.com
by 3/10, pilot start
by 3/15, visit Berkeley
by 3/25, draft finished
then video
February 28, 2007 9:24 AM
calling Philip
http://evoiceart.com/
Philip Martin Chavez
1261 Hopkins Street
Berkeley, CA 94702
510 524-6043
JettChair@aol.com
by 3/10, pilot start
by 3/15, visit Berkeley
by 3/25, draft finished
then video
February 28, 2007 9:24 AM
calling Philip
VJ dev notes
dotNET3SpeechTest
- WORKS: SAPI 5.3 using System.Speech in Console app
SAPILib
- WORKS: wrapper around managed SAPI 5.1, for easily setting up contexts and grammars
SAPILibTester
- WORKS: an app for selecting dictation/command and input file, as well as a simplest Form app that uses SAPILib
SimpleSAPI
- WORKS: a simplest Form app that uses managed SAPI 5.1 without the SAPILib wrapper
SimpleSAPI_5_3
- DOESN'T WORK: contains WinFX Window app using SAPI 5.3 System.Speech and SpeechRecognizer, a .NET 2.0 Console using SAPI 5.3, and .NET 2.0 Form app using SAPI 5.3 with [MTAThread]
- WinFX Window app stops recognizing after mouse movement within window
Issues:
==========
SAPI 5.1:
Result.RecoContext.Recognizer.AudioInput raises exception always
Result.RecoContext.Recognizer.GetFormat(SpeechFormatType.SFTInput) raises exception always
Result.Alternates(10, 0, -1).Item(0) raises exception always on dictation
Status:
=======
VoiceDraw, the new code with SAPI doesn't quite work: (new.txt)
Right now, as soon as settings control panel is opened, speech stops working
actually seems to stop working after some delay...
Actually, it looks like it's working fine until the real mouse is moved to a part of the application window that contains some .NET 3.0 widgets
- SAPI stops responding whenever I mouse over a GUI component
- if I also type on the keyboard fast, even when my mouse is not over the gui but the GUI is in focus, it sometimes makes SAPI nonresponsive.
SAPI 5.3:
in Console app, it works!!!!
in .NET 2.0 Form. it works if you change the prefix to Main in Program.cs to [MTAThread]!
in WinFX Windows, it doesn't work (fails on _speechRecogniser.SetInputToDefaultAudioDevice())
=> Aha, but it works if I use SpeechRecognizer instead of SpeechRecognitionEngine!!!!
-- well... not quite... DAMN! it still stops recognizing when mouse is moved over the GUI...
-- maybe it's because my SDK is not the newest one? Try reinstalling with newest...
===> still broken after Windows SDK reinstall
====> AAAaactually... it seems to work upon fresh restart. Maybe I wasn't closing the speech engine properly, so subsequent runs weren't working...
WPFSAPITest
- DOESN'T WORK: WinFX Window app using SAPILib, stops recognizing after mouse movement within window or fast key presses
===> still broken after Windows SDK reinstall
====> this one doesn't seem to work even after a fresh restart
=====> WAAAAAIIITT!!! It works!!! I tried using SpeechLib directly without my SAPILib, and it works fine!!!!! Crap, so it's my SAPILib's fault.. but at least it works
Ok, now, in VoiceDraw, when I try to switch back from VJ to command and control, it hangs upon trying to pause/stop VJ.
=> oooh, it makes sense, since I'm trying to stop VJ from inside the callabck, of course it'll block! I need some kind of a "schedule pause/stop"...
==> ok, so I fixed the pausing part, it pauses fine and I can switch back to speech reco, but when I try to switch back again to VJ, it hangs.
===> hehehehe!! I fixed it, I wasn't setting m_running to false in requestPause()!! now it works!!!!!!
2/19 8:00pm
- sweeeet, got undo working fairly easily.
-> hmm, now another problem.... I had assumed I can change the opacity and color of the stroke variably throughout the stroke, but it doesn't seem like I can.... the only thing I can change is the thickness....
==> talked with Richard, seems like there's a way to implement custom DynamicRenderer to do what I want!
color picker
brush menu palatte
=> [main] "slow brush" -> (show floating confirmation)
shape palette
=> [main] "rectangle" -> aaauuuu to position?
using drawing instead of ink canvas for doing opacity/color gradient?
PLANS (2/21) (13.5 hr)
===================
get dialog box working (1.5 hr)
- pop up a dialog box
- get speech events to bubble up to it
create color picker (2.5 hr)
- control for picking color out of 2D
- control for adjusting brightness
- get vowel events to move the 2D color point
- discrete sound to switch focus between 2D color and brightness
speed brushes (1 hr)
- create dialog box to pick a brush
implement variable color/opacity brush (3 hr)
- implement my own DynamicRenderer and possibly Stroke?
voice menu (2 hr)
- discrete sound to trigger a pie menu
- four commands per pie, vowel-silence will pick a pie
navigation (panning/zooming) (2 hr)
- aiue to pan, "ch" to change to zooming mode?
help (1.5 hr)
- have a floating, translucent help box
ACTUAL (2/21) (13.5 hr)
===================
get dialog box working (2 hr)
- pop up a dialog box
- get speech events to bubble up to it
create color picker (7 hr)
http://www.123aspx.com/redir.aspx?res=30630
- control for picking color out of 2D
- control for adjusting brightness
- get vowel events to move the 2D color point
- discrete sound to switch focus between 2D color and brightness
speed brushes (3 hr)
- create dialog box to pick a brush
implement variable color/opacity brush ()
- implement my own DynamicRenderer and possibly Stroke?
voice menu ()
- discrete sound to trigger a pie menu
- four commands per pie, vowel-silence will pick a pie
navigation (panning/zooming) ()
- aiue to pan, "ch" to change to zooming mode?
help ()
- have a floating, translucent help box
February 28, 2007 9:27 AM
calling Philip
let me describe to you in more detail what we’re hoping to do over the next few weeks.
- I’m a PhD student in Computer Science
- we hope to get feedback from several users on what they think about the program, and go through several iterations of design
- I’d like to visit you and have you try our software, and also to interview you about your current practices
- we hope to then be able to publish our work at a Human Computer Interaction conference in October, and with your permission, we’d like to include your comments and feedbacks, and if also possible, some artifacts from you trying out our system.
- also, I’d like to invite you to our workshop at San Jose on April 29th (Sunday, 9am-6pm), on voice-based interaction
Questions:
1. How do you currently paint? How to open the program, how to select tool, do you use pencil, line, square?
2. What other devices do you use (joystick, trackball, head tracker, eye tracker)?
February 28, 2007 9:03 PM
Ok, goal for tonight:
1. Get pie menu working
2. Get non-speech menu navigation to work (ta ta ta)
And future goals:
1. control stroke opacity/color
2. draw line, circle, square
February 28, 2007 11:49 PM
Ok, looking into how to customize menus...
1) http://msdn.microsoft.com/msdnmag/issues/07/01/Foundations/
2) http://www.codeproject.com/useritems/CustomTreeViewLayout.asp
3) http://www.codeproject.com/WPF/AdvancedCustomTreeViewLyt.asp
Hmm, 3) is very clear.. now I see that ContextMenu and ContextMenuItem both derive from ItemsControl, which are “boxes” that hold arbitrary content
ItemsControl Class description in MSDN:
http://msdn2.microsoft.com/en-us/library/system.windows.controls.itemscontrol.aspx
So, ItemsControl, which is the super class of Menu and thus ContextMenu, holds items.
ItemsControl can have the following properties:
- ItemsControl.Template
- contains <ControlTemplate TargetType=“the subclass of ItemsControl”>
- inside <ControlTemplate>, can add some adornments like border, but then eventually contains <ItemsPresenter/>, which uses the ItemsPanelTemplate defined in ItemsControl.ItemsPanel. If ItemsPanelTemplate not specified, it uses default, which specifies a StackPanel
- ItemsControl.ItemsPanel
- contains <ItemsPanelTemplate>
- inside <ItemsPanelTemplate>, can contain some panel such as <WrapPanel/>, affecting how items are laid out
- ItemsControl.ItemTemplate
- contains <DataTemplate>
- inside <DataTemplate>, can contain <DataTemplate.Resources> for resources, and then any other visual tree like <Grid>. Defines the visualization of the data objects
- ItemsControl.ItemContainerStyle
- contains <Style>
- inside <Style>, can contain any set of <Setters> and <Style.Triggers> to define the appearance of the element containing the data
ItemCollection Class members:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/cpref30/html/T_System_Windows_Controls_ItemCollection_Members.htm
So:
ContextMenu.ItemsPanel
change to RadialPanel
MenuItem.ItemsPanel
change to RadialPanel
MenuItem.Template
change to wedge look
Changing the ItemsPanel for both ContextMenu and MenuItem seem to work ok, but changing the Template of MenuItem is causing problems, as I seem to have to reimplement the triggers and such to cause the submenus to appear properly.
=> well ok now, the problem seemed to have been
Is there a way to get the index of the current MenuItem within XAML? or using ValueConverter?
=> yes, Panel.Children.IndexOf(child)
Menu ControlTemplate Example in MSDN:
http://msdn2.microsoft.com/en-us/library/ms752296.aspx
Styling with ControlTemplates Sample
<WPFSamplesInstallPath>\Controls\ControlTemplateExamples
Ok, with the sample, now have a full custom ControlTemplate working for ContextMenu.
Next, need to change it so that the Template draws wedges, and ItemsPanel uses RadialPanel to fan out the wedges
March 1, 2007 6:04 PM
Ok, I think I got the whole ContextMenu control template figured out, now need to implement the right RadialPanel and use it to affect the layout in the ItemsPanel
March 2, 2007 2:53 PM
Custom Radial Panel Sample
<WPFSamplesInstallPath>\Layout\RadialPanel
Position a Custom Context Menu in a RichTextBox Sample
<WPFSamplesInstallPath>\Editing\RichTextBox_ContextMenu
ContextMenu PlacementMode Enumeration
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/cpref30/html/T_System_Windows_Controls_Primitives_PlacementMode.htm
ContextMenu Class MSDN doc
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/cpref30/html/T_System_Windows_Controls_ContextMenu.htm
Popup Overview MSDN doc
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/wpf_conceptual/html/774f53ca-bff8-470e-9ce9-3928b4cf3d4c.htm
How to: Animate a Popup MSDN doc
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/wpf_conceptual/html/acaa2a0a-6137-4efd-9cd1-75ece222e390.htm
Pie Menu vision
http://tkfiles.storage.msn.com/x1pT3nQ1-5-4pqrE5mfJ2RhGzwA7ll6taE3b4AMC0TSO0ESFPGC_o94tq2QE10xbrL72Lmz_FUOquYh_zl9O0F_cx62-rMHu4eyNiZCPL7IW6IEjR9GYyvJ5w
Trying to get the popup menu to show up centered around the cursor when clicked, but centered on the screen when invoked through code....
Or through code, should be able to specify the point over which to show, in which case the menu should be centered over that point.
can’t seem to nest bindings, e.g. {Binding Source={Binding Source={StaticResource resourceName}}}
Hmm,
<Label Content="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource childToWedgeWidthConv}}"></Label>
seems to be evaluated at the point in the XML so it doesn’t count all the children...
right now, PieMenuChildToWedgeWidthConverter is modified to treat value as the parent instead of the child
March 3, 2007 12:53 PM
Ok, plan for today:
❑ pie menu working
❑ radial wedge display working
❑ can programatically navigate menu
❑ link VJ vowels to radial direction
Do I want the pie menu to scale as the user changes its size? Or just take up more/less space and keep the contained objects fixed size? Existing menus do the latter. So perhaps I should too.
I could probably do the latter, but still support the former behavior, if I do something like
<canvas width=1000 height=1000>
<viewbox>
<local:radialPanel width=100 height=100>
</viewbox>
</canvas>
Question: if I size an element in the control template, does that size get reflected in the ArrangeOverride? Or is it just the actual control element that gets to say what its desired size is?
Answer: I believe it’s the former, since when the RotateTransform is applied inside ArrangeOverride, it actually affects all the drawn geometries and stuff as well
Although.. it might be that the effect is that way, but the actual size doesn’t include those geometries....
Ok, so for dynamically binding to sizes, should use RenderSize (or ActualHeight/Width) as the read-only parameter... I think.. (p 129 of the WPF Unleashed)
Transforms never changes the values of ActualHeight/Width/RenderSize
Damn it, I can’t figure out how to get the pie wedge to be drawn at the right scale.... ok, maybe I can get some hint from the way the GridPanel does its equal-spaced row thing.
wait... maybe I just need to give the children the right sizes from RadialPanel in MeasureOverride? or in ArrangeOverride?
Ok, added the ability for the ValueConverter to return a PathGeometry, which seems to be working well except for the scaling issue still.
=> aha, I was explicitly setting the context menu size in Window1.xaml... duh!
March 6, 2007 1:18 AM
Ok, finally get to come back to this...
ok, pies are looking good, things are rendering at the right scale, now just need to pretty it up a bit, and get it to be controllable through VJ
get the inner circle removed
get the pie content to be oriented properly
get the sub pies to render correctly
Background
BorderBrush
BorderThickness
Foreground
CCC, CCN, CNC, CNN - wedge tiny, centered
NCC, NCN, NNC, NNN, without grid - right size, wedge shifted down, sides seem to align though
Ok, radial pie menu “functional” in a sense that it displays correctly and interacts correctly.
March 6, 2007 6:11 PM
Online color picker
http://www.febooti.com/products/iezoom/online-help/online-color-chart-picker.html
March 6, 2007 8:34 PM
Ok, tonight:
❑ finish integrating VJ into pie menu in VoiceDraw
❑ Save
Ellipse’s Bitmap effect doesn’t seem to
- WORKS: SAPI 5.3 using System.Speech in Console app
SAPILib
- WORKS: wrapper around managed SAPI 5.1, for easily setting up contexts and grammars
SAPILibTester
- WORKS: an app for selecting dictation/command and input file, as well as a simplest Form app that uses SAPILib
SimpleSAPI
- WORKS: a simplest Form app that uses managed SAPI 5.1 without the SAPILib wrapper
SimpleSAPI_5_3
- DOESN'T WORK: contains WinFX Window app using SAPI 5.3 System.Speech and SpeechRecognizer, a .NET 2.0 Console using SAPI 5.3, and .NET 2.0 Form app using SAPI 5.3 with [MTAThread]
- WinFX Window app stops recognizing after mouse movement within window
Issues:
==========
SAPI 5.1:
Result.RecoContext.Recognizer.AudioInput raises exception always
Result.RecoContext.Recognizer.GetFormat(SpeechFormatType.SFTInput) raises exception always
Result.Alternates(10, 0, -1).Item(0) raises exception always on dictation
Status:
=======
VoiceDraw, the new code with SAPI doesn't quite work: (new.txt)
Right now, as soon as settings control panel is opened, speech stops working
actually seems to stop working after some delay...
Actually, it looks like it's working fine until the real mouse is moved to a part of the application window that contains some .NET 3.0 widgets
- SAPI stops responding whenever I mouse over a GUI component
- if I also type on the keyboard fast, even when my mouse is not over the gui but the GUI is in focus, it sometimes makes SAPI nonresponsive.
SAPI 5.3:
in Console app, it works!!!!
in .NET 2.0 Form. it works if you change the prefix to Main in Program.cs to [MTAThread]!
in WinFX Windows, it doesn't work (fails on _speechRecogniser.SetInputToDefaultAudioDevice())
=> Aha, but it works if I use SpeechRecognizer instead of SpeechRecognitionEngine!!!!
-- well... not quite... DAMN! it still stops recognizing when mouse is moved over the GUI...
-- maybe it's because my SDK is not the newest one? Try reinstalling with newest...
===> still broken after Windows SDK reinstall
====> AAAaactually... it seems to work upon fresh restart. Maybe I wasn't closing the speech engine properly, so subsequent runs weren't working...
WPFSAPITest
- DOESN'T WORK: WinFX Window app using SAPILib, stops recognizing after mouse movement within window or fast key presses
===> still broken after Windows SDK reinstall
====> this one doesn't seem to work even after a fresh restart
=====> WAAAAAIIITT!!! It works!!! I tried using SpeechLib directly without my SAPILib, and it works fine!!!!! Crap, so it's my SAPILib's fault.. but at least it works
Ok, now, in VoiceDraw, when I try to switch back from VJ to command and control, it hangs upon trying to pause/stop VJ.
=> oooh, it makes sense, since I'm trying to stop VJ from inside the callabck, of course it'll block! I need some kind of a "schedule pause/stop"...
==> ok, so I fixed the pausing part, it pauses fine and I can switch back to speech reco, but when I try to switch back again to VJ, it hangs.
===> hehehehe!! I fixed it, I wasn't setting m_running to false in requestPause()!! now it works!!!!!!
2/19 8:00pm
- sweeeet, got undo working fairly easily.
-> hmm, now another problem.... I had assumed I can change the opacity and color of the stroke variably throughout the stroke, but it doesn't seem like I can.... the only thing I can change is the thickness....
==> talked with Richard, seems like there's a way to implement custom DynamicRenderer to do what I want!
color picker
brush menu palatte
=> [main] "slow brush" -> (show floating confirmation)
shape palette
=> [main] "rectangle" -> aaauuuu to position?
using drawing instead of ink canvas for doing opacity/color gradient?
PLANS (2/21) (13.5 hr)
===================
get dialog box working (1.5 hr)
- pop up a dialog box
- get speech events to bubble up to it
create color picker (2.5 hr)
- control for picking color out of 2D
- control for adjusting brightness
- get vowel events to move the 2D color point
- discrete sound to switch focus between 2D color and brightness
speed brushes (1 hr)
- create dialog box to pick a brush
implement variable color/opacity brush (3 hr)
- implement my own DynamicRenderer and possibly Stroke?
voice menu (2 hr)
- discrete sound to trigger a pie menu
- four commands per pie, vowel-silence will pick a pie
navigation (panning/zooming) (2 hr)
- aiue to pan, "ch" to change to zooming mode?
help (1.5 hr)
- have a floating, translucent help box
ACTUAL (2/21) (13.5 hr)
===================
get dialog box working (2 hr)
- pop up a dialog box
- get speech events to bubble up to it
create color picker (7 hr)
http://www.123aspx.com/redir.aspx?res=30630
- control for picking color out of 2D
- control for adjusting brightness
- get vowel events to move the 2D color point
- discrete sound to switch focus between 2D color and brightness
speed brushes (3 hr)
- create dialog box to pick a brush
implement variable color/opacity brush ()
- implement my own DynamicRenderer and possibly Stroke?
voice menu ()
- discrete sound to trigger a pie menu
- four commands per pie, vowel-silence will pick a pie
navigation (panning/zooming) ()
- aiue to pan, "ch" to change to zooming mode?
help ()
- have a floating, translucent help box
February 28, 2007 9:27 AM
calling Philip
let me describe to you in more detail what we’re hoping to do over the next few weeks.
- I’m a PhD student in Computer Science
- we hope to get feedback from several users on what they think about the program, and go through several iterations of design
- I’d like to visit you and have you try our software, and also to interview you about your current practices
- we hope to then be able to publish our work at a Human Computer Interaction conference in October, and with your permission, we’d like to include your comments and feedbacks, and if also possible, some artifacts from you trying out our system.
- also, I’d like to invite you to our workshop at San Jose on April 29th (Sunday, 9am-6pm), on voice-based interaction
Questions:
1. How do you currently paint? How to open the program, how to select tool, do you use pencil, line, square?
2. What other devices do you use (joystick, trackball, head tracker, eye tracker)?
February 28, 2007 9:03 PM
Ok, goal for tonight:
1. Get pie menu working
2. Get non-speech menu navigation to work (ta ta ta)
And future goals:
1. control stroke opacity/color
2. draw line, circle, square
February 28, 2007 11:49 PM
Ok, looking into how to customize menus...
1) http://msdn.microsoft.com/msdnmag/issues/07/01/Foundations/
2) http://www.codeproject.com/useritems/CustomTreeViewLayout.asp
3) http://www.codeproject.com/WPF/AdvancedCustomTreeViewLyt.asp
Hmm, 3) is very clear.. now I see that ContextMenu and ContextMenuItem both derive from ItemsControl, which are “boxes” that hold arbitrary content
ItemsControl Class description in MSDN:
http://msdn2.microsoft.com/en-us/library/system.windows.controls.itemscontrol.aspx
So, ItemsControl, which is the super class of Menu and thus ContextMenu, holds items.
ItemsControl can have the following properties:
- ItemsControl.Template
- contains <ControlTemplate TargetType=“the subclass of ItemsControl”>
- inside <ControlTemplate>, can add some adornments like border, but then eventually contains <ItemsPresenter/>, which uses the ItemsPanelTemplate defined in ItemsControl.ItemsPanel. If ItemsPanelTemplate not specified, it uses default, which specifies a StackPanel
- ItemsControl.ItemsPanel
- contains <ItemsPanelTemplate>
- inside <ItemsPanelTemplate>, can contain some panel such as <WrapPanel/>, affecting how items are laid out
- ItemsControl.ItemTemplate
- contains <DataTemplate>
- inside <DataTemplate>, can contain <DataTemplate.Resources> for resources, and then any other visual tree like <Grid>. Defines the visualization of the data objects
- ItemsControl.ItemContainerStyle
- contains <Style>
- inside <Style>, can contain any set of <Setters> and <Style.Triggers> to define the appearance of the element containing the data
ItemCollection Class members:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/cpref30/html/T_System_Windows_Controls_ItemCollection_Members.htm
So:
ContextMenu.ItemsPanel
change to RadialPanel
MenuItem.ItemsPanel
change to RadialPanel
MenuItem.Template
change to wedge look
Changing the ItemsPanel for both ContextMenu and MenuItem seem to work ok, but changing the Template of MenuItem is causing problems, as I seem to have to reimplement the triggers and such to cause the submenus to appear properly.
=> well ok now, the problem seemed to have been
Is there a way to get the index of the current MenuItem within XAML? or using ValueConverter?
=> yes, Panel.Children.IndexOf(child)
Menu ControlTemplate Example in MSDN:
http://msdn2.microsoft.com/en-us/library/ms752296.aspx
Styling with ControlTemplates Sample
<WPFSamplesInstallPath>\Controls\ControlTemplateExamples
Ok, with the sample, now have a full custom ControlTemplate working for ContextMenu.
Next, need to change it so that the Template draws wedges, and ItemsPanel uses RadialPanel to fan out the wedges
March 1, 2007 6:04 PM
Ok, I think I got the whole ContextMenu control template figured out, now need to implement the right RadialPanel and use it to affect the layout in the ItemsPanel
March 2, 2007 2:53 PM
Custom Radial Panel Sample
<WPFSamplesInstallPath>\Layout\RadialPanel
Position a Custom Context Menu in a RichTextBox Sample
<WPFSamplesInstallPath>\Editing\RichTextBox_ContextMenu
ContextMenu PlacementMode Enumeration
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/cpref30/html/T_System_Windows_Controls_Primitives_PlacementMode.htm
ContextMenu Class MSDN doc
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/cpref30/html/T_System_Windows_Controls_ContextMenu.htm
Popup Overview MSDN doc
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/wpf_conceptual/html/774f53ca-bff8-470e-9ce9-3928b4cf3d4c.htm
How to: Animate a Popup MSDN doc
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETFX30SDK4VS.1033/wpf_conceptual/html/acaa2a0a-6137-4efd-9cd1-75ece222e390.htm
Pie Menu vision
http://tkfiles.storage.msn.com/x1pT3nQ1-5-4pqrE5mfJ2RhGzwA7ll6taE3b4AMC0TSO0ESFPGC_o94tq2QE10xbrL72Lmz_FUOquYh_zl9O0F_cx62-rMHu4eyNiZCPL7IW6IEjR9GYyvJ5w
Trying to get the popup menu to show up centered around the cursor when clicked, but centered on the screen when invoked through code....
Or through code, should be able to specify the point over which to show, in which case the menu should be centered over that point.
can’t seem to nest bindings, e.g. {Binding Source={Binding Source={StaticResource resourceName}}}
Hmm,
<Label Content="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource childToWedgeWidthConv}}"></Label>
seems to be evaluated at the point in the XML so it doesn’t count all the children...
right now, PieMenuChildToWedgeWidthConverter is modified to treat value as the parent instead of the child
March 3, 2007 12:53 PM
Ok, plan for today:
❑ pie menu working
❑ radial wedge display working
❑ can programatically navigate menu
❑ link VJ vowels to radial direction
Do I want the pie menu to scale as the user changes its size? Or just take up more/less space and keep the contained objects fixed size? Existing menus do the latter. So perhaps I should too.
I could probably do the latter, but still support the former behavior, if I do something like
<canvas width=1000 height=1000>
<viewbox>
<local:radialPanel width=100 height=100>
</viewbox>
</canvas>
Question: if I size an element in the control template, does that size get reflected in the ArrangeOverride? Or is it just the actual control element that gets to say what its desired size is?
Answer: I believe it’s the former, since when the RotateTransform is applied inside ArrangeOverride, it actually affects all the drawn geometries and stuff as well
Although.. it might be that the effect is that way, but the actual size doesn’t include those geometries....
Ok, so for dynamically binding to sizes, should use RenderSize (or ActualHeight/Width) as the read-only parameter... I think.. (p 129 of the WPF Unleashed)
Transforms never changes the values of ActualHeight/Width/RenderSize
Damn it, I can’t figure out how to get the pie wedge to be drawn at the right scale.... ok, maybe I can get some hint from the way the GridPanel does its equal-spaced row thing.
wait... maybe I just need to give the children the right sizes from RadialPanel in MeasureOverride? or in ArrangeOverride?
Ok, added the ability for the ValueConverter to return a PathGeometry, which seems to be working well except for the scaling issue still.
=> aha, I was explicitly setting the context menu size in Window1.xaml... duh!
March 6, 2007 1:18 AM
Ok, finally get to come back to this...
ok, pies are looking good, things are rendering at the right scale, now just need to pretty it up a bit, and get it to be controllable through VJ
get the inner circle removed
get the pie content to be oriented properly
get the sub pies to render correctly
Background
BorderBrush
BorderThickness
Foreground
CCC, CCN, CNC, CNN - wedge tiny, centered
NCC, NCN, NNC, NNN, without grid - right size, wedge shifted down, sides seem to align though
Ok, radial pie menu “functional” in a sense that it displays correctly and interacts correctly.
March 6, 2007 6:11 PM
Online color picker
http://www.febooti.com/products/iezoom/online-help/online-color-chart-picker.html
March 6, 2007 8:34 PM
Ok, tonight:
❑ finish integrating VJ into pie menu in VoiceDraw
❑ Save
Ellipse’s Bitmap effect doesn’t seem to
Friday, February 16, 2007
Tools for C# documentation generation
A nice guide on using NDoc 2005 to generate MSDN-style documentation from C# comments:
http://geekswithblogs.net/sudheersblog/archive/2006/07/24/86146.aspx
And a nice overview of the C# XML commenting format:
http://www.codeproject.com/csharp/csharpcommentinganddocs.asp
http://geekswithblogs.net/sudheersblog/archive/2006/07/24/86146.aspx
And a nice overview of the C# XML commenting format:
http://www.codeproject.com/csharp/csharpcommentinganddocs.asp
Friday, February 9, 2007
Setting up DokuWiki
DocuWiki is a nice simple Wiki software that doesn't require a database and is fairly simple and light weight. Here are some steps on how to get it set up on a Unix web server:
- Download the latest package from here and extract the .tgz file in your home directory:
tar -xzvf dokuwiki-yyyy-MM-DD.tgz
From here on we'll assume that the package was extracted into ~/dokuwiki. - Move the extracted directory to a desired location in the web space:
mv ~/dokuwiki ~/www/mywiki
From here on we'll assume that the directory was moved to ~/www/mywiki. - Set the permissions by giving global write access to the following directories (yes this isn't ideal but then you'll have to have the web admin set up the permissions for you):
chmod 0777 ~/www/mywiki/conf
chmod -R 0777 ~/www/mywiki/data - Run the installer script by loading the page http://servername
/mywiki/install.php. You may need to then change the permission of the file ~/dokuwiki/conf/local.php so that you can edit it in the proceeding steps: cp ~/dokuwiki/conf/local.php ~/dokuwiki/conf/local.php.cp
mv -f ~/dokuwiki/conf/local.php.cp ~/dokuwiki/conf/local.php
chmod 0666 ~/dokuwiki/conf/local.php - Perform the following steps to secure the install directories (details available here):
- Create a dokuwiki directory outside of the www directory (e.g. ~/dokuwiki).
- Move ~/www/mywiki/bin to ~/dokuwiki/bin.
- Move ~/www/mywiki/data to ~/dokuwiki/data.
- Add the following line to ~www/mywiki/conf/local.php:
$conf['savedir']='~/dokuwiki/data' - Move ~/www/mywiki/conf to ~/dokuwiki/conf.
- Create a file ~/dokuwiki/prepend.php containing the following lines:
<?php
define('DOKU_CONF','~/dokuwiki/conf/'); - Add the following line to ~www/mywiki/.htaccess:
php_value auto_prepend_file "~/dokuwiki/prepend.php" - Move ~/www/mywiki/inc to ~/dokuwiki/inc.
- Add the following line to ~/dokuwiki/prepend.php:
define('DOKU_INC','~/dokuwiki/'); - Move ~/www/mywiki/lib to ~/dokuwiki/lib.
- Create a symbolic link to the lib directory from the web directory:
ln -s ~/dokuwiki/lib ~/www/mywiki/lib - To enable installation of plugins, change the permission of the plugins directory:
chmod 077 ~/dokuwiki/lib/plugins - Go to http://servername/mywiki/, and log in as the administrator.
- Install the PageMove plugin by clicking on the Admin button in the lower right corner, and then the "Manage Plugins" link, and enter the following URL into the URL textbox and click Download:
http://www.isection.co.uk/lib/exe/fetch.php?id=start&cache=cache&media=pagemove.zip
Subscribe to:
Comments (Atom)