|
dude, if google is more useful than you what good are you
dev
|
|
|
|
|
Google is only as useful as the person using (or NOT using) it.
If you can't do research and teach yourself, you're screwed in this business.
|
|
|
|
|
eat some icecream sour old man
dev
|
|
|
|
|
Funny you should say that...but it has nothing to do with ME being a sour old man.
|
|
|
|
|
Hey, I only speak the truth. If you can't handle it, don't be whiny about it and go get some ice cream yourself.
|
|
|
|
|
Good day
I a use a plugin interface to load a screen from a dll module. I created a thread to load a User Control from a separate dll. The user control form the plugin dll uses WPF to display some charts as a dashboard. When I use a normal WinForm user control it works fine but with the WPF user control I get a thread access error. Is there a way to allow access to the thread of a WPF form?
Here is my thread code that gets the uc from the dll
public void constructStartScreen()
{
ucSystemStartScreen _ucSystemStartScreen = new ucSystemStartScreen();
foreach (PluginInterface Plugin in TPlugins.PluginList)
{
if (Plugin.getSystemTag() == TPlugins.theSelectedPlugin)
{
ucBaseUserControl theStartScreen = new ucBaseUserControl();
theStartScreen = Plugin.getStartScreen();
if (theStartScreen != null)
{
theStartScreen.Dock = DockStyle.Fill;
theStartScreen.UserCurrentInfo.SetUserInfo(TUserInfo.UserID);
theStartScreen.UserCurrentInfo.IsLogedOn = TUserInfo.IsLogedOn;
theStartScreen.UserCurrentInfo.Connection = TUserInfo.Connection;
theStartScreen.theSystemDBTag = Plugin.getSystemDBTag();
_ucSystemStartScreen.setStartScreen(theStartScreen);
_ucSystemStartScreen.Dock = DockStyle.Fill;
DataTable RecentList = _MenuSystemDAO.getRecentList(TUserInfo.UserID);
_ucSystemStartScreen.loadRecentList(RecentList);
_ucSystemStartScreen.CanClose = true;
_ucSystemStartScreen.UserCurrentInfo.SetUserInfo(TUserInfo.UserID);
_ucSystemStartScreen.UserCurrentInfo.IsLogedOn = TUserInfo.IsLogedOn;
_ucSystemStartScreen.UserCurrentInfo.Connection = TUserInfo.Connection;
_ucSystemStartScreen.theSystemDBTag = Plugin.getSystemDBTag();
addStartScreen(_ucSystemStartScreen);
}
break;
}
}
}
The code in the DLL
public ucBaseUserControl getStartScreen()
{
ucHRStartScreen _ucHRStartScreen = new ucHRStartScreen();
return _ucHRStartScreen;
}
The
ucHRStartScreen has a elementhost control that loads the WPF screens.
|
|
|
|
|
There isn't enough code to see exactly what your doing, but the general problem is that you cannot touch/create/use/modify/whatever UI controls from anything other than the UI (startup) thread. Doing this stuff from any other thread will lead to the problems you're seeing, and more. This applies to both WPF and WinForms.
|
|
|
|
|
Please help me on this .... its very urgent and trying from last 10 days, otherwise tell me how save the file directly to disk using web browser control.
|
|
|
|
|
You can't do it directly. Check the documentation[^] to see which methods or properties can get the page content. My guess would be one of the DocumentXxx properties.
Veni, vidi, abiit domum
|
|
|
|
|
You can't do it using the WebBrowser control.
You CAN do it using the WebClient[^] class.
|
|
|
|
|
Hello All,
I've written a Windows application for adding data into an existing XML file that has the following schema:
<lectures>
<lecture>
<speakername>
</speakername>
<subject>
</subject>
<date>
</date>
<time>
</time>
<location>
</location>
</lecture>
</lectures>
There are more than one < lecture > node in the file, the above code just shows the schema of the file. The user adds data to an existing XML file by entering values into textboxes which correspond to the various child nodes of the < lecture > nodes in the XML file. Then when the user is done he/she can simply click the submit button to add data to the existing XML file. As it is, the app works but the data are not sorted. I would like to sort the XML file by date so that the dates are in ascending order. Please point me to a web page that discusses how this can be done or show me an example. Thanks in advance for your help.
modified 24-Nov-13 3:21am.
|
|
|
|
|
ASPnoob wrote: Please point me to a web page Google is very good at doing that.
A fairly simple solution would be to deserialize the XML data into a collection class[^], then sort it before rewriting it back to the XML file.
Veni, vidi, abiit domum
|
|
|
|
|
Hello there,
I am developing an app that will have HTML/JS/CSS as the user interface component and then the back end will be C# that will be dynamically updating this web page. In order to do that i need the C# functions to be able to call JS functions in HTML page and the JS functions to be able to call C# functions.
First of all, is this possible?
If possible, how can i do that?
Please guide me with sample code.
Thanks in advance.
|
|
|
|
|
Well, first of all, you cannot get a server to push to a client over HTTP. It's a request/response protocol only. The reason for this is quite simple. The server has no idea if the client is still on the same page expecting data. The web server NEVER calls the client.
Typically, the client will "refresh" a part of the page, such as data, by calling a method in your webserver to request new data over Ajax.
|
|
|
|
|
First of all, forget about HTTP and all.
I'm talking about a win forms app with a WinBrowser control embedded in it.
No networks calls
|
|
|
|
|
You still can NOT do it. The two runtimes are completely separate and your only bridge between them is some kind of communication transport, such as Ajax.
The JavaScript code is running inside the browser without any knowledge at all of anything outside of the sandbox it's running in in the browser.
|
|
|
|
|
Don Guy wrote: First of all, is this possible?
As expressed - no.
You have two applications. They need to communicate. So you will need a communications protocol that will run over a socket.
How you do that depends on what exactly is running on the client and what exactly is running on the server.
You might want to also insure that you really, really want to push to the client because that is very likely going to make things much more complicated. But if so then that is what you will be doing so you can google for that.
|
|
|
|
|
try this:
functionName.OnClientClick = " return JavascriptSFunctionName()";
bofore this,you should make sure your JavascriptSfunction return true or false
|
|
|
|
|
Wrong, wrong, wrong. This is not calling a C# method from JavaScript, nor the other way around.
|
|
|
|
|
Hi I have created a windows phone app 7.1 that counts the taps, it has a reset button as well, I have coded it and no errors are showing, the app opens perfectly in the emulator but when you tap the screen no count happens, I have been through the code so many time Im nearly dizzy .
anyone who can spot anything wrong would very much appreciated.
--------------------------
MainPage.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
namespace PhoneAppSolution
{
public partial class MainPage : PhoneApplicationPage
{
int count = 0;
Setting<int> savedCount = new Setting<int>("SavedCount", 0);
public MainPage()
{
InitializeComponent();
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
this.count++;
this.CountTextBlock.Text = this.count.ToString("NO");
}
void ResetButton_Click(object sender, RoutedEventArgs e)
{
this.count = 0;
this.CountTextBlock.Text = this.count.ToString("NO");
}
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
this.savedCount.Value = this.count;
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
this.count = this.savedCount.Value;
this.CountTextBlock.Text = this.count.ToString("NO");
}
}
}
-----------------------------------------------------------
Setting.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.IsolatedStorage;
namespace PhoneAppSolution
{
public class Setting<num>
{
string name;
num value;
num defaultValue;
bool hasValue;
public Setting(string name, num defaultValue)
{
this.name = name;
this.defaultValue = defaultValue;
}
public num Value
{
get
{
if(!this.hasValue)
{
if (!IsolatedStorageSettings.ApplicationSettings.TryGetValue(
this.name, out this.value))
{
this.value = this.defaultValue;
IsolatedStorageSettings.ApplicationSettings[this.name] = this.value;
}
this.hasValue = true;
}
return this.value;
}
set
{
IsolatedStorageSettings.ApplicationSettings[this.name] = value;
this.value = value;
this.hasValue = true;
}
}
public num DefaultValue
{
get { return this.DefaultValue; }
}
public void ForceRefresh()
{
this.hasValue = false;
}
}
}
--------------------------------------------------------------
MainPage.xaml
<phone:PhoneApplicationPage
x:Class="PhoneAppSolution.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeHuge}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<Grid x:Name="LayoutRoot" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="TitlePanel" Margin="12,17,0,28" Grid.ColumnSpan="2">
<TextBlock x:Name="ApplicationTitle" Text="Tally" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="tap to count" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<TextBlock x:Name="CountTextBlock" Grid.Row="1" TextAlignment="Center" Text="0" Grid.ColumnSpan="2" />
<Button x:Name="ResetButton" Grid.Row="1" Click="ResetButton_Click" Content="reset" Margin="21,343,1,143" />
</Grid>
</phone:PhoneApplicationPage>
Any help really appreciated.
Paddy
|
|
|
|
|
Your event handler signature looks wrong. They should look something like this:
private void button1_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("button click");
}
private void ContentPanel_Tap(object sender, GestureEventArgs e)
{
MessageBox.Show("tap");
}
Have you wired up the handlers somewhere? You can do this in the designer's property grid by selecting the Events tab. Double-Click on an event name and it will create the code stub for you.
|
|
|
|
|
Quote: on web site it will automatic detect profile at web config, so how to make web application can detect, anyone can help me it very hard for me?
based on this example if convert to web applicaion, it also cant detect profile at webconfig,so how to slove it
any kind person can download this example http://csharpdotnetfreak.blogspot.com/2009/05/aspnet-creating-shopping-cart-example.html[^]and convert the profile to web application make sure it able to detect
|
|
|
|
|
That's not going to happen. Nobody is going to do your work for you.
|
|
|
|
|
ok tell me why it cant detect inside the excample it ady have a class file
|
|
|
|
|
I have no idea what you just said. It makes no sense at all.
|
|
|
|