Search Results

Search found 461 results on 19 pages for 'eventhandler'.

Page 10/19 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Repeater ItemDataBound Complete Trigger

    - by OliverS
    Hi I have a Repeater and I am doing various things during the ItemDataBound event. My Repeater is in a control. What I am noticing is that the things that are supposed to happen in the ItemDataBound event happen after the Page_Load of the page hosting the control. Is there a way to use some sort of ItemDataBoundComplete trigger so I can do other things on my page after the events of the ItemDataBound have taken place? Thanks, please let me know if I have not been clear. [Edit] I have controls that are being bound to the ItemDataBound and they are not available until after the Page_Load for the page hosting the control. [Solution] (In my case): In my page I used the following: Control.Page.LoadComplete += new EventHandler(Control_LoadComplete); Then I performed what I had to do in that event.

    Read the article

  • Why are events and commands in MVVM so unsupported by WPF / Visual Studio?

    - by Edward Tanguay
    When creating an WPF application with the MVVM pattern, it seems I have to gather the necessary tools myself to even begin the most rudimentary event handling, e.g. AttachedBehaviors I get from here DelegateCommands I get from here Now I'm looking for some way to handle the ItemSelected event in a ComboBox and am getting suggestions of tricks and workarounds to do this (using a XAML trigger or have other elements bound to the selected item, etc.). Ok, I can go down this road, but it seems to be reinventing the wheel. It would be nice to just have an ItemSelected command that I can handle in my ViewModel. Am I missing some set of standard tools or is everyone doing MVVM with WPF basically building and putting together their own collection of tools just so they can do the simplest plumbing tasks with events and commands, things that take only a couple lines in code-behind with a Click="eventHandler"?

    Read the article

  • ASP.NET Call Another Element's DoPostBack Function

    - by blu
    I have an ASP.NET control that has an onclick event handler rendered inline on the element. I would like to call that function and have it raise the target control's server side event handler. <asp:CheckBox ID="Foo" runat="server" AutoPostBack="true" Text="Foo" /> <a href="#" onclick="javascript:setTimeout('__doPostBack(\'Foo\',\'\')', 0)">Test </a> I created the checkbox, looked at the rendered function on the field, and then copied that into the onclick on the anchor element. The anchor will raise a postback, but the event handler for the check box is not raised. protected override void OnLoad(EventArgs e) { // fires for checkbox // fires for anchor (the anchor does cause a postback) } void Foo_CheckedChanged(object sender, EventArgs e) { // fires for checkbox // does not fire for anchor } protected override void OnInit(EventArgs e) { this.Foo.CheckedChanged += new EventHandler(Foo_CheckedChanged); } Is it possible to do this?

    Read the article

  • Tool to generate a GUI (WinForms or WPF) from a class.

    - by Pat
    Say we've got a class like public class Doer { public int Timeout {get;set;} public string DoIt(string input) { string toReturn; // Do something that involves a Timeout return toReturn; } } Is there a tool that would create a Form or Control for prototyping this class? The GUI might have a NumericUpDown control with a label of "Timeout" and a GroupBox with a TextBox for "input" and a button labeled "DoIt" with an eventhandler that calls Doer.DoIt with the Text property of the input TextBox and puts the response in another TextBox.

    Read the article

  • I am deploying a Silverlight APPlication that calls a WCF Service

    - by Rico
    It Runs It Loads but when it calls the service I get An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at SalesSimplicityPO_SL.POSvc.GetPurchaseOrdersCompletedEventArgs.get_Result() at SalesSimplicityPO_SL.About.mySvc_GetPurchaseOrdersCompleted(Object sender, GetPurchaseOrdersCompletedEventArgs e) at SalesSimplicityPO_SL.POSvc.POSvcClient.OnGetPurchaseOrdersCompleted(Object state) What is the problem does anyone know? I load and call my web service like.. BasicHttpBinding binding = new BasicHttpBinding(); EndpointAddress address = new EndpointAddress(new Uri("http://localhost/POSystem/POSvc.svc")); POSvc.POSvcClient mySvc = new POSvc.POSvcClient(binding, address); mySvc.InsertPOCompleted += new EventHandler<SalesSimplicityPO_SL.POSvc.InsertPOCompletedEventArgs>(mySvc_InsertPOCompleted); mySvc.InsertPOAsync(InitialsTextBox.Text.ToString(), DescTextBox.Text.ToString(), ClientTextBox.Text.ToString()); Works great in debug.... What am i Doing to get this error?

    Read the article

  • Is there a way to know in VB.NET if a handler has been registered for an event?

    - by Seth Spearman
    In C# I can test for this... public event EventHandler Trigger; protected void OnTrigger(EventArgs e) { if (Trigger != null) Trigger(this, e); } Is there a way to do this in VB.NET? Test for null I mean? MORE INFO I forgot to mention. I have classes written in C# but I am writing my unit tests in VB.NET. I am trying this in the unit test... If myObject.Trigger IsNot Nothing Then 'do something End If This is causing a compile time error which says ... "Public Event Trigger is an Event and cannot be called directly. Use the RaiseEvent statement to raise an event." Seth

    Read the article

  • Execute HtttModule for extionsionless URL only

    - by Malcolm Frexner
    I have an httpModule which has to run before an ActionMethod. I dont want that it is executed when a request for an image comes in. For some reasons I realy need an HttpModule and cant use an ActionFilter What is the way to do this? public class PostAuthenticateModule : IHttpModule { public void Init(HttpApplication app) { app.PostAuthenticateRequest += new EventHandler(this.OnEnter); } private void OnEnter(object source, EventArgs eventArgs) { } private static void Initialize() { } public void Dispose() { } } web.config <httpModules> <add type="PostAuthenticateModule.PostAuthenticateModule , PostAuthenticateModule" name="PostAuthenticateModule"/> </httpModules>

    Read the article

  • Silverlight4 Printing Question

    - by hallgato.attila
    Hello everyone! I'm having a problem with printing. Is it possible to print a (customized) DataGrid which doesn't fit the page? a) Using a ViewBox to make it fit one page. My problem here is that I can get the PrintableArea.Width and PrintableArea.Height in the PrintPage EventHandler, from the PrintPageEventArgs, but in that Event Handler I can't set the size of an UIElement before it gets printed. b) Multiple pages. Is it possible somehow to print the whole DataGrid, even the parts which are not visible (don't fit the page) and to somehow make the PrintableArea only a part of the DataGrid?

    Read the article

  • Mocking a non-settable child property with Rhino Mocks

    - by Marcus
    I currently have interfaces much like the following: interface IService { void Start(); IHandler ServiceHandler { get; } } interface IHandler { event EventHandler OnMessageReceived; } Using Rhino Mocks, it's easy enough to mock IService, but it doesn't assign any IHandler instance to the ServiceHandler property. Therefore when my method under test adds an event handler to _mockedService.ServiceHandler.OnMessageReceived, I get an 'Object reference not set' error. How can I ensure that ServiceHandler is assigned a value in the mocked IService instance? This is likely Rhino Mocks 101, but I'm just getting up to speed on it...

    Read the article

  • Generic WithEvents

    - by serhio
    Error: 'WithEvents' variables can only be typed as classes, interfaces or type parameters with class constraints Background: Public Class Tadpole(Of T As IVisibleChanged, P As IVisibleChanged) Private WithEvents _Tad As T ' ERROR ' Private WithEvents _Pole As P ' ERROR ' Public Property Tad() As T ... Public Property Pole() As P ... End Class ''' IVisibleChanged ''' Public Interface IVisibleChanged Property Visible() As Boolean Event VisibleChanged As EventHandler End Interface Workaround: a. Use AddHandler to handle events defined in a structure. EDIT b. use Private WithEvents _Tad AsIVisibleChanged (M.A. Hanin) c. ?

    Read the article

  • Limited options for accessing events in derived classes?

    - by maxp
    Im refactoring a class, and moving sections into a base class. I have a few events similar to public event EventHandler GridBinding; Which are now in the base class, but i am finding i cannot now check to see if the event is null in my derived class. Doing so gives me the error: The event 'xyz.GridBinding' can only appear on the left hand side of += or -= (except when used from within the type 'xyz._MyBaseClass'). Is this correct, am i missing anything, or is there any way to get around this or is writing an accessor the only way to do this? I am using c#/.net 4.0

    Read the article

  • How can I keep a graphics object centered (like a circle) when zooming in or out on it?

    - by sonny5
    using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Drawing.Drawing2D; using System.Drawing.Imaging; namespace testgrfx { public class Form1 : System.Windows.Forms.Form { float m_Scalef; float m_Scalefout; Rectangle m_r1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.ComponentModel.Container components = null; private void InitializeComponent() { m_Scalef = 1.0f; // for zooming purposes Console.WriteLine("opening m_Scalef= {0}",m_Scalef); m_Scalefout = 1.0f; Console.WriteLine("opening m_Scalefout= {0}",m_Scalefout); m_r1 = new Rectangle(50,50,100,100); this.AutoScrollMinSize = new Size(600,700); this.components = new System.ComponentModel.Container(); this.button2 = new System.Windows.Forms.Button(); this.button2.BackColor = System.Drawing.Color.LightGray; this.button2.Location = new System.Drawing.Point(120, 30); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(72, 24); this.button2.TabIndex = 1; this.button2.Text = "Zoom In"; this.button2.Click += new System.EventHandler(this.mnuZoomin_Click); this.Controls.Add(button2); this.button3 = new System.Windows.Forms.Button(); this.button3.BackColor = System.Drawing.Color.LightGray; this.button3.Location = new System.Drawing.Point(200, 30); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(72, 24); this.button3.TabIndex = 2; this.button3.Text = "Zoom Out"; this.button3.Click += new System.EventHandler(this.mnuZoomout_Click); this.Controls.Add(button3); //InitMyForm(); } public Form1() { InitializeComponent(); Text = " DrawLine"; BackColor = SystemColors.Window; // Gotta load these kind at start-up ... not with button assignments this.Paint+=new PaintEventHandler(this.Form1_Paint); } static void Main() { Application.Run(new Form1()); } /// Clean up any resources being used. protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } // autoscroll2.cs does work private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { Graphics dc = e.Graphics; dc.PageUnit = GraphicsUnit.Pixel; dc.PageScale = m_Scalef; Console.WriteLine("opening dc.PageScale= {0}",dc.PageScale); dc.TranslateTransform(this.AutoScrollPosition.X/m_Scalef, this.AutoScrollPosition.Y/m_Scalef); Pen pn = new Pen(Color.Blue,2); dc.DrawEllipse(pn,m_r1); Console.WriteLine("form_paint_dc.PageUnit= {0}",dc.PageUnit); Console.WriteLine("form_paint_dc.PageScale= {0}",dc.PageScale); //Console.Out.NewLine = "\r\n\r\n"; // makes all double spaces } private void mnuZoomin_Click(object sender, System.EventArgs e) { m_Scalef = m_Scalef * 2.0f; Console.WriteLine("in mnuZoomin_Click m_Scalef= {0}",m_Scalef); Invalidate(); // to trigger Paint of entire client area } // try: System.Drawing.Rectangle resolution = Screen.GetWorkingArea(someForm); private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { // Uses the mouse wheel to scroll Graphics dc = CreateGraphics(); dc.TranslateTransform(this.AutoScrollPosition.X/m_Scalef, this.AutoScrollPosition.Y/m_Scalef); Console.WriteLine("opening Form1_MouseDown dc.PageScale= {0}", dc.PageScale); Console.WriteLine("Y wheel= {0}", this.AutoScrollPosition.Y/m_Scalef); dc.PageUnit = GraphicsUnit.Pixel; dc.PageScale = m_Scalef; Console.WriteLine("frm1_moudwn_dc.PageScale= {0}",dc.PageScale); Point [] mousep = new Point[1]; Console.WriteLine("mousep= {0}", mousep); // make sure to adjust mouse pos.for scroll position Size scrollOffset = new Size(this.AutoScrollPosition); mousep[0] = new Point(e.X-scrollOffset.Width, e.Y-scrollOffset.Height); dc.TransformPoints(CoordinateSpace.Page, CoordinateSpace.Device,mousep); Pen pen = new Pen(Color.Green,1); dc.DrawRectangle(pen,m_r1); Console.WriteLine("m_r1= {0}", m_r1); Console.WriteLine("mousep[0].X= {0}", mousep[0].X); Console.WriteLine("mousep[0].Y= {0}", mousep[0].Y); if (m_r1.Contains(new Rectangle(mousep[0].X, mousep[0].Y,1,1))) MessageBox.Show("click inside rectangle"); } private void Form1_Load(object sender, System.EventArgs e) { } private void mnuZoomout_Click(object sender, System.EventArgs e) { Console.WriteLine("first line--mnuZoomout_Click m_Scalef={0}",m_Scalef); if(m_Scalef > 9 ) { m_Scalef = m_Scalef / 2.0f; Console.WriteLine("in >9 mnuZoomout_Click m_Scalef= {0}",m_Scalef); Console.WriteLine("in >9 mnuZoomout_Click__m_Scalefout= {0}",m_Scalefout); } else { Console.WriteLine("<= 9_Zoom-out B-4 redefining={0}",m_Scalef); m_Scalef = m_Scalef * 0.5f; // make it same as previous Zoom In Console.WriteLine("<= 9_Zoom-out after m_Scalef= {0}",m_Scalef); } Invalidate(); } } // public class Form1 }

    Read the article

  • Adding checkbox dynamically

    - by shiv09
    public Form1 f1 = new Form1(); int p = 150; int q = 100; public void add() { //CheckBox c = new CheckBox(); //c.Location = new Point(p, q); //c.Text = f1.sub[0]; //this.Controls.Add(c); CheckBox chkBox = new CheckBox(); chkBox.Location = new Point(p, q); chkBox.Text = "Checked"; chkBox.Checked = false; chkBox.CheckState = CheckState.Checked; chkBox.CheckedChanged += new EventHandler(chkBox_CheckedChanged);// this.Controls.Add(chkBox); chkBox.Text = f1.sub[1];//The problem is here...whatever value I supply to sub[] it gives the below mentioned error } Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Here sub[] is a list in form1 which has 5 values...

    Read the article

  • Storyboard as timer in WPF

    - by Adrian
    Hi, I'm trying to do smooth animation in procedural code. For this (in Silverlight at least), it's recommended to use the Storyboard timer rather than a DispatcherTimer. So I use something like this: Storyboard _LoopTimer = new Storyboard(); public void StartAnimation() { _LoopTimer.Duration = TimeSpan.FromMilliseconds(0); _LoopTimer.Completed += new EventHandler(MainLoop); _LoopTimer.Begin(); } void MainLoop(object sender, EventArgs e) { // Do animation stuff here // Continue storyboard timer _LoopTimer.Begin(); } And in Silverlight, this works fine. But in WPF, I only hit MainLoop() once. Setting RepeatBehaviour to Forever doesn't help, either. So what's the right way to do this in WPF with a Storyboard? Thanks very much.

    Read the article

  • deadlock when using WCF Duplex Polling with Silverlight

    - by Kobi Hari
    Hi all. I have followed Tomek Janczuk's demonstration on silverlight tv to create a chat program that uses WCF Duplex Polling web service. The client subscribes to the server, and then the server initiates notifications to all connected clients to publish events. The Idea is simple, on the client, there is a button that allows the client to connect. A text box where the client can write a message and publish it, and a bigger text box that presents all the notifications received from the server. I connected 3 clients (in different browsers - IE, Firefox and Chrome) and it all works nicely. They send messages and receive them smoothly. The problem starts when I close one of the browsers. As soon as one client is out, the other clients get stuck. They stop getting notifications. I am guessing that the loop in the server that goes through all the clients and sends them the notifications is stuck on the client that is now missing. I tried catching the exception and removing it from the clients list (see code) but it still does not help. any ideas? The server code is as follows: using System; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Activation; using System.Collections.Generic; using System.Runtime.Remoting.Channels; namespace ChatDemo.Web { [ServiceContract] public interface IChatNotification { // this will be used as a callback method, therefore it must be one way [OperationContract(IsOneWay=true)] void Notify(string message); [OperationContract(IsOneWay = true)] void Subscribed(); } // define this as a callback contract - to allow push [ServiceContract(Namespace="", CallbackContract=typeof(IChatNotification))] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)] public class ChatService { SynchronizedCollection<IChatNotification> clients = new SynchronizedCollection<IChatNotification>(); [OperationContract(IsOneWay=true)] public void Subscribe() { IChatNotification cli = OperationContext.Current.GetCallbackChannel<IChatNotification>(); this.clients.Add(cli); // inform the client it is now subscribed cli.Subscribed(); Publish("New Client Connected: " + cli.GetHashCode()); } [OperationContract(IsOneWay = true)] public void Publish(string message) { SynchronizedCollection<IChatNotification> toRemove = new SynchronizedCollection<IChatNotification>(); foreach (IChatNotification channel in this.clients) { try { channel.Notify(message); } catch { toRemove.Add(channel); } } // now remove all the dead channels foreach (IChatNotification chnl in toRemove) { this.clients.Remove(chnl); } } } } The client code is as follows: void client_NotifyReceived(object sender, ChatServiceProxy.NotifyReceivedEventArgs e) { this.Messages.Text += string.Format("{0}\n\n", e.Error != null ? e.Error.ToString() : e.message); } private void MyMessage_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { this.client.PublishAsync(this.MyMessage.Text); this.MyMessage.Text = ""; } } private void Button_Click(object sender, RoutedEventArgs e) { this.client = new ChatServiceProxy.ChatServiceClient(new PollingDuplexHttpBinding { DuplexMode = PollingDuplexMode.MultipleMessagesPerPoll }, new EndpointAddress("../ChatService.svc")); // listen for server events this.client.NotifyReceived += new EventHandler<ChatServiceProxy.NotifyReceivedEventArgs>(client_NotifyReceived); this.client.SubscribedReceived += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(client_SubscribedReceived); // subscribe for the server events this.client.SubscribeAsync(); } void client_SubscribedReceived(object sender, System.ComponentModel.AsyncCompletedEventArgs e) { try { Messages.Text += "Connected!\n\n"; gsConnect.Color = Colors.Green; } catch { Messages.Text += "Failed to Connect!\n\n"; } } And the web config is as follows: <system.serviceModel> <extensions> <bindingExtensions> <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement, System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </bindingExtensions> </extensions> <behaviors> <serviceBehaviors> <behavior name=""> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <bindings> <pollingDuplex> <binding name="myPollingDuplex" duplexMode="MultipleMessagesPerPoll"/> </pollingDuplex> </bindings> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/> <services> <service name="ChatDemo.Web.ChatService"> <endpoint address="" binding="pollingDuplex" bindingConfiguration="myPollingDuplex" contract="ChatDemo.Web.ChatService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> </system.serviceModel>

    Read the article

  • Regarding Visual C# MenuItem: Where does the NullReference come from?

    - by Thomas
    Hi All. I have a problem creating MenuItems for a TreeView dynamically: here is the (simplified)code i'm using. public class CTM : TreeNode, IComparable, IComparable<CTM> { public CTM(CTMProvider provider) { this.provider = provider; this.manager = provider.manager; this.IEEEAddress = provider.IEEEAddress; this.endpoint = provider.state._conn.RemoteEndPoint; this.Text = String.Format("CTM: {0} {0}", IEEEAddress, ((System.Net.IPEndPoint)endpoint).ToString()); try { MenuItem meni = System.EventHandler(this.provider.Disconnect)); this.ContextMenu.MenuItems.Add(meni); } catch { Trace.TraceError("Could not create menu item!"); } } } This code always triggers the catch clause with a NullReferenceException. Any Ideas?

    Read the article

  • Asp.net Script manager conflicting with button

    - by DJPB
    Hi there. I'm working on an asp.net app and I have some controls that are created dinamically on the OnInit event. One of that controls is an asp button that has been working fine until now. When I add a ScriptManager to my page, that same button is unnable to postback. It's only working if a take the ScriptManager out. has anything like this ever appened to somebody else? Am I invalidating the page somehow? Tks ps: this is my scrip manager tag: <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnableScriptGlobalization="true" EnableScriptLocalization="true"> </asp:ScriptManager> //My Dynamic Button: Button button1 = new Button { ID = "button1", Text = "Ok" }; button1.Click += new EventHandler(Button1_Click);

    Read the article

  • How to get elements from an object in C#?

    - by Drew
    I am using the AutoCompleteBox in WPF, I populate the suggestions with a List that consists of four fields. When the user selects an item and I reach my eventHandler, i can see that MyAutoCompleteBox.SelectedItem is an object that has my four values, if i hover this text in the debugger i can see the four values listed, however i don't know how to access these values in the code. I tried List<Codes> selected = MyAutoCompleteBox.SelectedItem as List<Codes>; where Codes is my List. selected returns as null and empty every time. Is there a way to get to these values? Thanks!

    Read the article

  • Problem with access to control properties in Multibox

    - by greatromul
    I used multibox-component to create lightbox-similar div. But I faced problem. I placed textbox with id ‘tbx_position’ in that div. I entered some symbols in textbox and then tried to read value via javascript-function (it had to alert document.getElementById(‘tbx_position’).value). Every time that value was empty. There is example of it. Furthermore, if I place in the div asp:Button, server OnClick-eventhandler doesn’t catch fire. Is any idea, what’s reason? Thanks.

    Read the article

  • Getting error when compiled Http webrequest

    - by Afnan
    i have written a program to search value from google every thing works fine but first time when page is loaded then i encounter error.after words if i click any link it is working fine no errors further. Code is as follow private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { string raw = "http://www.google.com/search?hl=en&q={0}&aq=f&oq=&aqi=n1g10"; string search = string.Format(raw, HttpUtility.UrlEncode(searchTerm)); //string search = "http://www.whatismyip.com/"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(search); using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.ASCII)) { browserA = reader.ReadToEnd(); this.Invoke(new EventHandler(IE1)); } } }

    Read the article

  • HttpwebRequest Simulate Click

    - by Afnan
    I was working on httpwebrequest and was trying to search google get result and simulate click to desired link. Is that possible? string raw ="http://www.google.com/search?hl=en&q={0}&aq=f&oq=&aqi=n1g10"; string search = string.Format(raw, HttpUtility.UrlEncode(searchTerm)); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(search); request.Proxy = prox; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.ASCII)) { HtmlElementCollection html = reader.ReadToEnd(); browserA=reader.ReadToEnd(); this.Invoke(new EventHandler(IE1)); } }

    Read the article

  • Handling Dialogs in WPF with MVVM

    - by Ray Booysen
    In the MVVM pattern for WPF, handling dialogs is one of the more complex operations. As your view model does not know anything about the view, dialog communication can be interesting. I can expose an ICommand that when the view invokes it, a dialog can appear. Does anyone know of a good way to handle results from dialogs? I am speaking about windows dialogs such as MessageBox. One of the ways we did this was have an event on the viewmodel that the view would subscribe to when a dialog was required. public event EventHandler<MyDeleteArgs> RequiresDeleteDialog; This is OK, but it means that the view requires code which is something I would like to stay away from.

    Read the article

  • handle exit event of child process

    - by Ehsan
    I have a console application and in the Main method. I start a process like the code below, when process exists, the Exist event of the process is fired but it closed my console application too, I just want to start a process and then in exit event of that process start another process. It is also wired that process output is reflecting in my main console application. Process newCrawler = new Process(); newCrawler.StartInfo = new ProcessStartInfo(); newCrawler.StartInfo.FileName = configSection.CrawlerPath; newCrawler.EnableRaisingEvents = true; newCrawler.Exited += new EventHandler(newCrawler_Exited); newCrawler.StartInfo.Arguments = "someArg"; newCrawler.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; newCrawler.StartInfo.UseShellExecute = false; newCrawler.Start();

    Read the article

  • Session is null when inherit from System.Web.UI.Page

    - by Andreas K.
    I want to extend the System.Web.UI.Page-class with some extra stuff. In the ctor I need the value of a session-variable. The problem is that the Session-object is null... public class ExtendedPage : System.Web.UI.Page { protected foo; public ExtendedPage() { this.foo = (int)HttpContext.Current.Session["foo"]; // NullReferenceException } } If I move the part with the session-object into the Load-Event everything works fine... public class ExtendedPage : System.Web.UI.Page { protected foo; public ExtendedPage() { this.Load += new EventHandler(ExtendedPage_Load); } void ExtendedPage_Load(object sender, EventArgs e) { this.foo = (int)HttpContext.Current.Session["foo"]; } } Why is the Session-object null in the first case??

    Read the article

  • Need ILMerge hint

    - by lakhlaniprashant.blogspot.com
    Hi all, I'm trying to merge vintasoft barcode sdk with my data access dll and it's not working after ilmerge. Any ideas are welcome here is the error: IndexOutOfRangeException: Index was outside the bounds of the array.] 2.+.©(Byte[] param0) in :0 2.+..cctor() in :0 [TypeInitializationException: The type initializer for '2.+' threw an exception.] 2.+.¥S() in :0 Vintasoft.Barcode.WriterSettings..cctor() in :0 [TypeInitializationException: The type initializer for 'Vintasoft.Barcode.WriterSettings' threw an exception.] Vintasoft.Barcode.WriterSettings..ctor() in :0 Vintasoft.Barcode.BarcodeWriter..ctor() in :0 _Default.buttonGenerateBarcode_Click(Object sender, EventArgs e) in E:\ILMergeSample\WebBarcodeWriterDemo\QRBarcode.aspx.vb:27 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565 Thanks in advance

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >