M
martin_ch
Sali mitenand
Ich versuche gerade über Javascript eine SIlverlight Methode aufzurufen welche dann dynamisch Inhalte eines Panels leert und dann neue Elemente hinzufügen soll.
Die Funktion wird zwar aufgerufen allerding werden die Elemente nicht gelöscht - habe ich da was übersehen?
namespace SilverlightMultiTouch
{
[ScriptableType]
public partial class MainPage : UserControl
{
public StackPanel thePanel;
public MainPage()
{
thePanel = this.myPanel;
InitializeComponent();
HtmlPage.RegisterScriptableObject("test", this);
//HtmlPage.RegisterScriptableObject("test", this);
this.Loaded += (s, a) =>
{
//LoadImages();
//Initialize the items
System.Windows.Interactivity.Interaction.GetBehaviors(video).OfType<MultiTouchManipulationBehavior>().First().Move(new Point(300, 300), -20, 80);
System.Windows.Interactivity.Interaction.GetBehaviors(video).OfType<MultiTouchManipulationBehavior>().First().BringToFront();
System.Windows.Interactivity.Interaction.GetBehaviors(image1).OfType<MultiTouchManipulationBehavior>().First().Move(new Point(150, 250), 45, 100);
System.Windows.Interactivity.Interaction.GetBehaviors(image2).OfType<MultiTouchManipulationBehavior>().First().Move(new Point(400, 300), -45, 150);
System.Windows.Interactivity.Interaction.GetBehaviors(text1).OfType<MultiTouchManipulationBehavior>().First().Move(new Point(400, 300), -45, 150);
};
}
[ScriptableMember]
public void loadFromJavascript(){
System.Windows.Browser.HtmlPage.Window.Alert("Load From Java"); //funktioniert
LoadImages();
}
private void LoadImages()
{
thePanel.Children.Clear(); //geht nicht
myPanel.Children.Clear(); //geht auch nicht
System.Windows.Browser.HtmlPage.Window.Alert("Load From Java"); //funktioniert
}
}
}
<UserControl x:Class="SilverlightMultiTouch.MainPage"
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:behaviors="clr-namespace:MultiTouch.Behaviors.Silverlight;assembly=MultiTouch.Behaviors.Silverlight"
xmlns
="clr-namespace:Microsoft.SilverlightMediaFramework.Player;assembly=Microsoft.SilverlightMediaFramework.Player"
>
<Grid x:Name="LayoutRoot" Background="{StaticResource GlossyBlack_BackgroundGradient}">
<Canvas>
<Image Source="data/VOSolution/Aria/Gallery/kV_CBCT-CT prior to Fusion.jpg" x:Name="image1">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="True"
TouchRotateEnabled="True" TouchTranslateEnabled="True" TouchScaleEnabled="True"
/>
</interactivity:Interaction.Behaviors>
</Image>
<p:CoreSmoothStreamingMediaElement Visibility="Collapsed" x:Name="video" Background="{StaticResource GlossyBlack_BackgroundGradient}"
AutoPlay="True" SmoothStreamingSource="http://video3.smoothhd.com.edgesuite.net/ondemand/Big%20Buck%20Bunny%20Adaptive.ism/Manifest">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="True"
TouchRotateEnabled="True" TouchTranslateEnabled="True" TouchScaleEnabled="True"/>
</interactivity:Interaction.Behaviors>
</p:CoreSmoothStreamingMediaElement>
<Image Source="data/VOSolution/Aria/Gallery/iX-rotation_sans-patient.jpg" x:Name="image2">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="True"
TouchRotateEnabled="True" TouchTranslateEnabled="True" TouchScaleEnabled="True"/>
</interactivity:Interaction.Behaviors>
</Image>
<TextBlock Text="Hallo Welt" x:Name="text1">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="False"
TouchRotateEnabled="False" TouchTranslateEnabled="True" TouchScaleEnabled="True"/>
</interactivity:Interaction.Behaviors>
</TextBlock>
</Canvas>
<StackPanel x:Name="myPanel" VerticalAlignment="Bottom" Orientation="Horizontal" Height="150" Background="#dbe7f6" >
<TextBlock Text="Image Thumb" />
<TextBlock Text="Image Thumb" />
</StackPanel>
</Grid>
</UserControl>
Ich versuche gerade über Javascript eine SIlverlight Methode aufzurufen welche dann dynamisch Inhalte eines Panels leert und dann neue Elemente hinzufügen soll.
Die Funktion wird zwar aufgerufen allerding werden die Elemente nicht gelöscht - habe ich da was übersehen?
namespace SilverlightMultiTouch
{
[ScriptableType]
public partial class MainPage : UserControl
{
public StackPanel thePanel;
public MainPage()
{
thePanel = this.myPanel;
InitializeComponent();
HtmlPage.RegisterScriptableObject("test", this);
//HtmlPage.RegisterScriptableObject("test", this);
this.Loaded += (s, a) =>
{
//LoadImages();
//Initialize the items
System.Windows.Interactivity.Interaction.GetBehaviors(video).OfType<MultiTouchManipulationBehavior>().First().Move(new Point(300, 300), -20, 80);
System.Windows.Interactivity.Interaction.GetBehaviors(video).OfType<MultiTouchManipulationBehavior>().First().BringToFront();
System.Windows.Interactivity.Interaction.GetBehaviors(image1).OfType<MultiTouchManipulationBehavior>().First().Move(new Point(150, 250), 45, 100);
System.Windows.Interactivity.Interaction.GetBehaviors(image2).OfType<MultiTouchManipulationBehavior>().First().Move(new Point(400, 300), -45, 150);
System.Windows.Interactivity.Interaction.GetBehaviors(text1).OfType<MultiTouchManipulationBehavior>().First().Move(new Point(400, 300), -45, 150);
};
}
[ScriptableMember]
public void loadFromJavascript(){
System.Windows.Browser.HtmlPage.Window.Alert("Load From Java"); //funktioniert
LoadImages();
}
private void LoadImages()
{
thePanel.Children.Clear(); //geht nicht
myPanel.Children.Clear(); //geht auch nicht
System.Windows.Browser.HtmlPage.Window.Alert("Load From Java"); //funktioniert
}
}
}
<UserControl x:Class="SilverlightMultiTouch.MainPage"
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:behaviors="clr-namespace:MultiTouch.Behaviors.Silverlight;assembly=MultiTouch.Behaviors.Silverlight"
xmlns
![Stick out tongue :p :p](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f61b.png)
>
<Grid x:Name="LayoutRoot" Background="{StaticResource GlossyBlack_BackgroundGradient}">
<Canvas>
<Image Source="data/VOSolution/Aria/Gallery/kV_CBCT-CT prior to Fusion.jpg" x:Name="image1">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="True"
TouchRotateEnabled="True" TouchTranslateEnabled="True" TouchScaleEnabled="True"
/>
</interactivity:Interaction.Behaviors>
</Image>
<p:CoreSmoothStreamingMediaElement Visibility="Collapsed" x:Name="video" Background="{StaticResource GlossyBlack_BackgroundGradient}"
AutoPlay="True" SmoothStreamingSource="http://video3.smoothhd.com.edgesuite.net/ondemand/Big%20Buck%20Bunny%20Adaptive.ism/Manifest">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="True"
TouchRotateEnabled="True" TouchTranslateEnabled="True" TouchScaleEnabled="True"/>
</interactivity:Interaction.Behaviors>
</p:CoreSmoothStreamingMediaElement>
<Image Source="data/VOSolution/Aria/Gallery/iX-rotation_sans-patient.jpg" x:Name="image2">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="True"
TouchRotateEnabled="True" TouchTranslateEnabled="True" TouchScaleEnabled="True"/>
</interactivity:Interaction.Behaviors>
</Image>
<TextBlock Text="Hallo Welt" x:Name="text1">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="False"
TouchRotateEnabled="False" TouchTranslateEnabled="True" TouchScaleEnabled="True"/>
</interactivity:Interaction.Behaviors>
</TextBlock>
</Canvas>
<StackPanel x:Name="myPanel" VerticalAlignment="Bottom" Orientation="Horizontal" Height="150" Background="#dbe7f6" >
<TextBlock Text="Image Thumb" />
<TextBlock Text="Image Thumb" />
</StackPanel>
</Grid>
</UserControl>