Search Results

Search found 422 results on 17 pages for 'componentmodel'.

Page 7/17 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Abstract Forms using WinForms

    - by pm_2
    I’m trying to achieve a similar affect in a WinForms application as a master form does with ASP.NET. My initial thoughts on this were to create a base form and declare it as abstract, but the compiler doesn’t seem to let me do this. public abstract partial class Master : Form { public Master() { InitializeComponent(); } } So I have two questions: Why will the compiler not let me do this? Am I using the wrong syntax or is this a genuine restriction. Can anyone suggest a workaround or better way to do this? EDIT: InitializeComponent code: private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.Menu = this.mainMenu1; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.Text = "Master"; this.AutoScroll = true; }

    Read the article

  • Error calling webservice from JQuery

    - by Robban
    I have a strange problem when I'm trying to call a simple webservice method from Jquery. Locally it works fine, but on my test-server it does not. The jquery request looks like this (only showing the actual request and not the rest of the method): $.ajax({ type: "POST", url: "/Service/Service.asmx/AddTab", data: "tab=" + element.innerHTML, success: function(msg) { alert('success'); } }); When I run this locally from the test-server it works fine, which has me wondering if it could be some setting that I've missed in the IIS. If I navigate to the .asmx file and click the AddTab method I get a list of SOAP 1.1 and SOAP 1.2 XML, but not the HTTP POST request. If I navigate to it locally I get all three (SOAP 1.1, SOAP 1.2 and HTTP Post) The service is set up as follows: [WebService(Namespace = "mynamespace")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] [ScriptService()] public class Service : System.Web.Services.WebService { [WebMethod(EnableSession=true)] [ScriptMethod()] public void AddTab(string tab) { //Some code to add a tab which evidently works locally... } } Anyone have a clue what I'm missing here?

    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

  • integrating uppercut and cc.net

    - by deepasun
    I am trying to integrate uppercut and cc.net for getting build and revision... What do I have to put in the codebuild folder? while running cc.net, I'm getting svn folder Unable to execute file [D:\CodeBuild\abc\svn]. The file may not exist or may not be executable. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified Without cc.net integration can we get both build and revision incremented? When will build and revision get incremented?

    Read the article

  • Dynamic object property populator (without reflection)

    - by grenade
    I want to populate an object's properties without using reflection in a manner similar to the DynamicBuilder on CodeProject. The CodeProject example is tailored for populating entities using a DataReader or DataRecord. I use this in several DALs to good effect. Now I want to modify it to use a dictionary or other data agnostic object so that I can use it in non DAL code --places I currently use reflection. I know almost nothing about OpCodes and IL. I just know that it works well and is faster than reflection. I have tried to modify the CodeProject example and because of my ignorance with IL, I have gotten stuck on two lines. One of them deals with dbnulls and I'm pretty sure I can just lose it, but I don't know if the lines preceding and following it are related and which of them will also need to go. The other, I think, is the one that pulled the value out of the datarecord before and now needs to pull it out of the dictionary. I think I can replace the "getValueMethod" with my "property.Value" but I'm not sure. I'm open to alternative/better ways of skinning this cat too. Here's the code so far (the commented out lines are the ones I'm stuck on): using System; using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; public class Populator<T> { private delegate T Load(Dictionary<string, object> properties); private Load _handler; private Populator() { } public T Build(Dictionary<string, object> properties) { return _handler(properties); } public static Populator<T> CreateBuilder(Dictionary<string, object> properties) { //private static readonly MethodInfo getValueMethod = typeof(IDataRecord).GetMethod("get_Item", new [] { typeof(int) }); //private static readonly MethodInfo isDBNullMethod = typeof(IDataRecord).GetMethod("IsDBNull", new [] { typeof(int) }); Populator<T> dynamicBuilder = new Populator<T>(); DynamicMethod method = new DynamicMethod("Create", typeof(T), new[] { typeof(Dictionary<string, object>) }, typeof(T), true); ILGenerator generator = method.GetILGenerator(); LocalBuilder result = generator.DeclareLocal(typeof(T)); generator.Emit(OpCodes.Newobj, typeof(T).GetConstructor(Type.EmptyTypes)); generator.Emit(OpCodes.Stloc, result); int i = 0; foreach (var property in properties) { PropertyInfo propertyInfo = typeof(T).GetProperty(property.Key, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy | BindingFlags.Default); Label endIfLabel = generator.DefineLabel(); if (propertyInfo != null && propertyInfo.GetSetMethod() != null) { generator.Emit(OpCodes.Ldarg_0); generator.Emit(OpCodes.Ldc_I4, i); //generator.Emit(OpCodes.Callvirt, isDBNullMethod); generator.Emit(OpCodes.Brtrue, endIfLabel); generator.Emit(OpCodes.Ldloc, result); generator.Emit(OpCodes.Ldarg_0); generator.Emit(OpCodes.Ldc_I4, i); //generator.Emit(OpCodes.Callvirt, getValueMethod); generator.Emit(OpCodes.Unbox_Any, property.Value.GetType()); generator.Emit(OpCodes.Callvirt, propertyInfo.GetSetMethod()); generator.MarkLabel(endIfLabel); } i++; } generator.Emit(OpCodes.Ldloc, result); generator.Emit(OpCodes.Ret); dynamicBuilder._handler = (Load)method.CreateDelegate(typeof(Load)); return dynamicBuilder; } } EDIT: Using Marc Gravell's PropertyDescriptor implementation (with HyperDescriptor) the code is simplified a hundred-fold. I now have the following test: using System; using System.Collections.Generic; using System.ComponentModel; using Hyper.ComponentModel; namespace Test { class Person { public int Id { get; set; } public string Name { get; set; } } class Program { static void Main() { HyperTypeDescriptionProvider.Add(typeof(Person)); var properties = new Dictionary<string, object> { { "Id", 10 }, { "Name", "Fred Flintstone" } }; Person person = new Person(); DynamicUpdate(person, properties); Console.WriteLine("Id: {0}; Name: {1}", person.Id, person.Name); Console.ReadKey(); } public static void DynamicUpdate<T>(T entity, Dictionary<string, object> properties) { foreach (PropertyDescriptor propertyDescriptor in TypeDescriptor.GetProperties(typeof(T))) if (properties.ContainsKey(propertyDescriptor.Name)) propertyDescriptor.SetValue(entity, properties[propertyDescriptor.Name]); } } } Any comments on performance considerations for both TypeDescriptor.GetProperties() & PropertyDescriptor.SetValue() are welcome...

    Read the article

  • BackgroundWorker RunWorkerCompleted in a Component

    - by Sphynx
    I'm familiar with the following: "If the operation raises an exception that your code does not handle, the BackgroundWorker catches the exception and passes it into the RunWorkerCompleted event handler, where it is exposed as the Error property of System.ComponentModel.RunWorkerCompletedEventArgs. If you are running under the Visual Studio debugger, the debugger will break at the point in the DoWork event handler where the unhandled exception was raised." However, I've encountered a weird glitch. In my component, there's an instance of BackgroundWorker. Even though it's not running in the debugger, the exception remains unhandled by the worker. Even simplified code produces an unhandled exception (and RunWorkerCompleted doesn't fire): Throw New ArgumentException("Test") The main thing is the code of RunWorkerComplete: RaiseEvent UpdateComplete(Me, New AsyncCompletedEventArgs(e.Error, e.Cancelled, e.Result)) I need the component to expose the worker exception through a public event. If I remove the RaiseEvent call, the exception becomes handled by the worker, and accessible through e.Error. Apparently, raising an event causes the worker to miss the exception. How can that be?

    Read the article

  • Forcing WCF proxy to generate an alias prefix

    - by Sean Campbell
    To comply with a clients schema, I've been attempting to generate a WCF client proxy capable of serializing down to a structure with a root node that looks like the following: <quote:request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:quote="https://foo.com/services/schema/1.2/car_quote"> After some reading, I've had luck in updating the proxy to include the required 'quote' namespace through the use of XmlNameSpaceDeclarations and XmlSerializerNamespaces [System.SerializableAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class request { [XmlNamespaceDeclarations()] public XmlSerializerNamespaces xmlsn { get { XmlSerializerNamespaces xsn = new XmlSerializerNamespaces(); xsn.Add("quote", "https://foo.com/services/schema/1.2/car_quote"); return xsn; } set { //Just provide an empty setter. } } ... which delivers: <request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:quote="https://foo.com/services/schema/1.2/car_quote"> however I'm stumped as to how to generate the quote:request element. Environment: ASP.NET 3.5 Thanks

    Read the article

  • Error messages for model validation using data annotations

    - by oneBelizean
    Given the follow classes: using System.ComponentModel.DataAnnotations; public class Book{ public Contact PrimaryContact{get; set;} public Contact SecondaryContact{get; set;} [Required(ErrorMessage="Book name is required")] public string Name{get; set;} } public class Contact{ [Required(ErrorMessage="Name is required")] public string Name{get; set;} } Is there a clean way I can give a distinct error message for each instance of Contact in Book using DataAnnotations? For example, if the name was missing from the PrimaryContact instance the error would read "primary contact name is required". My current solution is to create a validation service that checks the model state for field errors then remove said errors and add them back using the specific language I'd like.

    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

  • How to store an enum inside a DataColum of a DataTable and show localized text in .Net

    - by SoMoS
    Hello, I have to store on one DataColum of one DataTable an Enum containing some values. De enum is defined as follow: Imports System.ComponentModel Imports System.Globalization Public Enum FirmwareUpdateStatus <Description("updateNotExecuted")> UpdateNotExecuted = 0 <Description("updateSuccess")> UpdateSuccess = 1 <Description("updateError")> UpdateError = 2 End Enum I have also a class called Enum2 that has a method called GetDescription that returns the localized text of an enum value. What I want to do is to show this text into the grid that shows the DataTable but storing the enum value, not the string. How can this be done? Thanks in advance"

    Read the article

  • ObservableCollection Implementation

    - by wpfwannabe
    I know I am missing something obvious but I can't seem to implement ObservableCollection in my class below. IE it won't show up in intellsense. Can someone please let me know what I am missing. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.Collections.ObjectModel; using System.Reflection; using System.ComponentModel; namespace MyBTOList { public class InventoryListBTO : List<InventoryBTO> { /// <summary> /// Get all inventory records from local database /// </summary> /// <returns></returns> public static InventoryListBTO GetAllInventoryRecords() { return GetInventoryListBO(Inventory.GetAllInventoryRecordsDb()); } } public class InventoryBTO : INotifyPropertyChanged { }

    Read the article

  • StringConverter with StandardValuesSupported and Autocompletion

    - by Marqus
    I want to develop a StringConverter with standard values, which after attaching it to a PropertyGrid will act like comboBox with autocompletion. The example below will give me a comboBox, but without the autocompletion - user have to expand it and choose manually one of the items. Is there a way to allow user to type the beginning of one of the options, so the combobox will automatically select the matching one? public class ConverterSample : System.ComponentModel.StringConverter { public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { //true means show a combobox return true; } public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return false; } public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { return new StandardValuesCollection(new List<string>(){"Stack", "overflow", "rules"); } List returned by GetStandardValues has to be dynamic, so I can't use any enum there. I took above example from: http://www.codeproject.com/KB/cpp/dropdownproperties.aspx

    Read the article

  • What version of DataAnnotations is included with ASP.NET MVC 2 RTM

    - by Nick Thoresby
    I'm working on a project using Visual Studio 2008 and have moved from the the MVC 2 Preview to RTM version. We would like to use model validation such as: public class ViewModel { [Required(ErrorMessage="UserName is required.")] [StringLength(10, ErrorMessage="UserName cannot be greater than 10 chars.")] public string UserName { get; set; } } [HttpPost] public ActionResult Register(ViewModel model) { if (ModelState.IsValid){} // Always true } However the ModelState.IsValid always returns true. I have a suspicion that it might be something to do with the version of System.ComponentModel.DataAnnotations.dll that we are referencing, currently version 99.0.0.0, which seems rather odd. Does anyone know what version of this dll is included with the MVC 2 RTM for Visual Studio 2008?

    Read the article

  • Are these libraries okay to distribute with my C# application?

    - by HoNgOuRu
    I included these libraries or namespaces in my C# application and published the solution as freeware. I used Visual C# Express 2008. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Media; using System.Management; using System.Diagnostics; using System.Runtime.InteropServices; using System.Drawing.Text; Is it okay to give the application as freeware or am I violating any license here???

    Read the article

  • How to open sticky notes from my app?

    - by Riddle
    i want to open windows sticky notes from my app, i already know how to do this for calculator and paint but not sticky notes. (windows form) using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace main { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start("mspaint"); System.Diagnostics.Process.Start("calc"); //sticky notes } } }

    Read the article

  • c#: sms appears to have been sent, but stuck in phone outbox

    - by I__
    i wrote code to send an SMS using my gsm phone which is attached to the computer through com port. the code is below. the problem is i do see that it is in the outbox of the phone and it actually appears to have been sent, but when i contact the recipient they say that i have not received the message. i test the phone, and i create and send a message using only the phone and it works perfectly, however when i do this with my code, it APPEARS to have been sent, and i am getting all the correct AT COMMAND responses from the phone, but the message is actually NOT sent. here is the code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; using System.IO.Ports; namespace WindowsFormsApplication1 { public partial class Form1 : Form { SerialPort serialPort1; int m_iTxtMsgState = 0; const int NUM_MESSAGE_STATES = 4; const string RESERVED_COM_1 = "COM1"; const string RESERVED_COM_4 = "COM4"; public Form1() { InitializeComponent(); this.Closing += new CancelEventHandler(Form1_Closing); } private void Form1_Load(object sender, EventArgs e) { serialPort1 = new SerialPort(GetUSBComPort()); if (serialPort1.IsOpen) { serialPort1.Close(); } serialPort1.Open(); //ThreadStart myThreadDelegate = new ThreadStart(ReceiveAndOutput); //Thread myThread = new Thread(myThreadDelegate); //myThread.Start(); this.serialPort1.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived); } private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { serialPort1.Close(); } private void SendLine(string sLine) { serialPort1.Write(sLine); sLine = sLine.Replace("\u001A", ""); consoleOut.Text += sLine; } public void DoWork() { ProcessMessageState(); } public void ProcessMessageState() { switch (m_iTxtMsgState) { case 0: m_iTxtMsgState = 1; SendLine("AT\r\n"); //NOTE: SendLine must be the last thing called in all of these! break; case 1: m_iTxtMsgState = 2; SendLine("AT+CMGF=1\r\n"); break; case 2: m_iTxtMsgState = 3; SendLine("AT+CMGW=" + Convert.ToChar(34) + "+9737387467" + Convert.ToChar(34) + "\r\n"); break; case 3: m_iTxtMsgState = 4; SendLine("A simple demo of SMS text messaging." + Convert.ToChar(26)); break; case 4: m_iTxtMsgState = 5; break; case 5: m_iTxtMsgState = NUM_MESSAGE_STATES; break; } } private string GetStoredSMSID() { return null; } /* //i dont think this part does anything private void serialPort1_DataReceived_1(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { string response = serialPort1.ReadLine(); this.BeginInvoke(new MethodInvoker(() => textBox1.AppendText(response + "\r\n"))); } */ void sp_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { Thread.Sleep(500); char[] msg; msg = new char[613]; int iNumToRead = serialPort1.BytesToRead; serialPort1.Read(msg, 0, iNumToRead); string response = new string(msg); this.BeginInvoke(new MethodInvoker(() => textBox1.AppendText(response + "\r\n"))); serialPort1.DiscardInBuffer(); if (m_iTxtMsgState == 4) { int pos_cmgw = response.IndexOf("+CMGW:"); string cmgw_num = response.Substring(pos_cmgw + 7, 4); SendLine("AT+CMSS=" + cmgw_num + "\r\n"); //stop listening to messages received } if (m_iTxtMsgState < NUM_MESSAGE_STATES) { ProcessMessageState(); } } catch { } } private void button1_Click(object sender, EventArgs e) { m_iTxtMsgState = 0; DoWork(); } private void button2_Click(object sender, EventArgs e) { string[] sPorts = SerialPort.GetPortNames(); foreach (string port in sPorts) { consoleOut.Text += port + "\r\n"; } } private string GetUSBComPort() { string[] sPorts = SerialPort.GetPortNames(); foreach (string port in sPorts) { if (port != RESERVED_COM_1 && port != RESERVED_COM_4) { return port; } } return null; } }

    Read the article

  • silverlight and windows workflow foundation

    - by wissem
    private void btnUpdate_Click(object sender, RoutedEventArgs e) { xxxxxxx.Workflow1_WebServiceSoapClient zer = new xxxxx.Workflow1_WebServiceSoapClient(); zer.demanderSubmitReportCompleted += new EventHandler<xxxxxxxxxxxxxxx.demanderSubmitReportCompletedEventArgs>(service2); zer.demanderSubmitReportAsync("zzz", 20000); } public void service2(object sender, xxxxx.demanderSubmitReportCompletedEventArgs e) { string a = e.Result; } I'm trying to call a windows workflow foundation published as a web service from a Silverlight project. When I call it from a console application it works fine because I can add a web reference then I just make an instance of that webservice then I invoke the method I want. The problem is in the silverlight project cause i can just add a service reference so I find myself working with soap stuff that doesn't work at all, and here is the code error: here is the code:i change it a litle bit in english Error in exécution Microsoft JScript: Unhandled Error in Silverlight Application exception happened in the operation, résult not valide. Consult InnerException for more information. in System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() in AEDSilverlightIntegrated.ServiceReference2.demanderSubmitReportCompletedEventArgs.get_Result() in AEDSilverlightIntegrated.SilverEntryAedHeaderNew.mmm_demanderSubmitReportCompleted(Object sender, demanderSubmitReportCompletedEventArgs e) in AEDSilverlightIntegrated.ServiceReference2.Workflow1_WebServiceSoapClient.OndemanderSubmitReportCompleted(Object state)

    Read the article

  • Adding more namespace in the code file affects performace ?

    - by Harikrishna
    If we imports more namespace in the code file(cs file) then it affects on perfomance ? Like we should add namespace in the cs file as needed. That is adding more namespace in the cs file affects performance ? Like using System; using System.Data.Sql; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Windows.Forms; using System.Xml; using System.Data.SqlClient; using System.ComponentModel;

    Read the article

  • XAML : How to change background color only in Design mode?

    - by Kave
    I have a control with white text foreground color and transparent background color. Later on this usercontrol will be added into a different control that carries the real background color. However during designing this, control due white foreground on white background in VS 2010, I can't obviously see anything. In there anyway to define a different color for just the design time? I have tried this: if (System.ComponentModel.DesignerProperties.IsInDesignTool) { LayoutRoot.Background = new SolidColorBrush(Colors.Blue); } But this doesn't work. Any tips? Thanks, Kave

    Read the article

  • How to detect crashing tabed webbrowser and handle it?

    - by David Eaton
    I have a desktop application (forms) with a tab control, I assign a tab and a new custom webrowser control. I open up about 10 of these tabs. Each one visits about 100 - 500 different pages. The trouble is that if 1 webbrowser control has a problem it shuts down the entire program. I want to be able to close the offending webbrowser control and open a new one in it's place. Is there any event that I need to subscribe to catch a crashing or unresponsive webbrowser control ? I am using C# on windows 7 (Forms), .NET framework v4 =============================================================== UPDATE: 1 - The Tabbed WebBrowser Example Here is the code I have and How I use the webbrowser control in the most basic way. Create a new forms project and name it SimpleWeb Add a new class and name it myWeb.cs, here is the code to use. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Security.Policy; namespace SimpleWeb { //inhert all of webbrowser class myWeb : WebBrowser { public myWeb() { //no javascript errors this.ScriptErrorsSuppressed = true; //Something we want set? AssignEvents(); } //keep near the top private void AssignEvents() { //assign WebBrowser events to our custom methods Navigated += myWeb_Navigated; DocumentCompleted += myWeb_DocumentCompleted; Navigating += myWeb_Navigating; NewWindow += myWeb_NewWindow; } #region Events //List of events:http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser_events%28v=vs.100%29.aspx //Fired when a new windows opens private void myWeb_NewWindow(object sender, System.ComponentModel.CancelEventArgs e) { //cancel all popup windows e.Cancel = true; //beep to let you know canceled new window Console.Beep(9000, 200); } //Fired before page is navigated (not sure if its before or during?) private void myWeb_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs args) { } //Fired after page is navigated (but not loaded) private void myWeb_Navigated(object sender, System.Windows.Forms.WebBrowserNavigatedEventArgs args) { } //Fired after page is loaded (Catch 22 - Iframes could be considered a page, can fire more than once. Ads are good examples) private void myWeb_DocumentCompleted(System.Object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs args) { } #endregion //Answer supplied by mo. (modified)? public void OpenUrl(string url) { try { //this.OpenUrl(url); this.Navigate(url); } catch (Exception ex) { MessageBox.Show("Your App Crashed! Because = " + ex.ToString()); //MyApplication.HandleException(ex); } } //Keep near the bottom private void RemoveEvents() { //Remove Events Navigated -= myWeb_Navigated; DocumentCompleted -= myWeb_DocumentCompleted; Navigating -= myWeb_Navigating; NewWindow -= myWeb_NewWindow; } } } On Form1 drag a standard tabControl and set the dock to fill, you can go into the tab collection and delete the pre-populated tabs if you like. Right Click on Form1 and Select "View Code" and replace it with this code. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using mshtml; namespace SimpleWeb { public partial class Form1 : Form { public Form1() { InitializeComponent(); //Load Up 10 Tabs for (int i = 0; i <= 10; i++) { newTab("Test_" + i, "http://wwww.yahoo.com"); } } private void newTab(string Title, String Url) { //Create a new Tab TabPage newTab = new TabPage(); newTab.Name = Title; newTab.Text = Title; //create webbrowser Instance myWeb newWeb = new myWeb(); //Add webbrowser to new tab newTab.Controls.Add(newWeb); newWeb.Dock = DockStyle.Fill; //Add New Tab to Tab Pages tabControl1.TabPages.Add(newTab); newWeb.OpenUrl(Url); } } } Save and Run the project. Using the answer below by mo. , you can surf the first url with no problem, but what about all the urls the user clicks on? How do we check those? I prefer not to add events to every single html element on a page, there has to be a way to run the new urls thru the function OpenUrl before it navigates without having an endless loop. Thanks.

    Read the article

  • Preventing ListBox scrolling to top when updated

    - by WDZ
    I'm trying to build a simple music player with a ListBox playlist. When adding audio files to the playlist, it first fills the ListBox with the filenames and then (on a separate thread) extracts the ID3 data and overwrites the filenames with the correct Artist - Title information (much like Winamp). But while the ListBox is being updated, it's unscrollable, as it always jumps to the top on every item overwrite. Any way to prevent this? EDIT: The code: public Form1() { //Some initialization code omitted here BindingList<TAG_INFO> trackList = new BindingList<TAG_INFO>(); // The Playlist this.playlist = new System.Windows.Forms.ListBox(); this.playlist.Location = new System.Drawing.Point(12, 12); this.playlist.Name = "playlist"; this.playlist.Size = new System.Drawing.Size(229, 316); this.playlist.DataSource = trackList; } private void playlist_add_Click(object sender, EventArgs e) { //Initialize OpenFileDialog OpenFileDialog opd = new OpenFileDialog(); opd.Filter = "Music (*.WAV; *.MP3; *.FLAC)|*.WAV;*.MP3;*.FLAC|All files (*.*)|*.*"; opd.Title = "Select Music"; opd.Multiselect = true; //Open OpenFileDialog if (DialogResult.OK == opd.ShowDialog()) { //Add opened files to playlist for (int i = 0; opd.FileNames.Length > i; ++i) { if (File.Exists(opd.FileNames[i])) { trackList.Add(new TAG_INFO(opd.FileNames[i])); } } //Initialize BackgroundWorker BackgroundWorker _bw = new BackgroundWorker(); _bw.WorkerReportsProgress = true; _bw.DoWork += new DoWorkEventHandler(thread_trackparser_DoWork); _bw.ProgressChanged += new ProgressChangedEventHandler(_bw_ProgressChanged); //Start ID3 extraction _bw.RunWorkerAsync(); } } void thread_trackparser_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker _bw = sender as BackgroundWorker; for (int i = 0; i < trackList.Count; ++i) { //Pass extracted tag info to _bw_ProgressChanged for thread-safe playlist entry update _bw.ReportProgress(0,new object[2] {i, BassTags.BASS_TAG_GetFromFile(trackList[i].filename)}); } } void _bw_ProgressChanged(object sender, ProgressChangedEventArgs e) { object[] unboxed = e.UserState as object[]; trackList[(int)unboxed[0]] = (unboxed[1] as TAG_INFO); } EDIT2: Much simpler test case: Try scrolling down without selecting an item. The changing ListBox will scroll to the top again. using System; using System.Windows.Forms; namespace WindowsFormsApplication1 { public class Form1 : Form { private System.ComponentModel.IContainer components = null; protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.listBox1 = new System.Windows.Forms.ListBox(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.SuspendLayout(); // listBox1 this.listBox1.FormattingEnabled = true; this.listBox1.Location = new System.Drawing.Point(0, 0); this.listBox1.Name = "listBox1"; this.listBox1.Size = new System.Drawing.Size(200, 290); // timer1 this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // Form1 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(200, 290); this.Controls.Add(this.listBox1); this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); } private System.Windows.Forms.ListBox listBox1; private System.Windows.Forms.Timer timer1; public Form1() { InitializeComponent(); for (int i = 0; i < 45; i++) listBox1.Items.Add(i); } int tickCounter = -1; private void timer1_Tick(object sender, EventArgs e) { if (++tickCounter > 44) tickCounter = 0; listBox1.Items[tickCounter] = ((int)listBox1.Items[tickCounter])+1; } } static class Program { [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }

    Read the article

  • Converting BindingList(Of T) to Array

    - by George
    Public Class Orders Inherits System.ComponentModel.BindingList(Of Order) End Class Public Sub DataBind(ByVal Orders() As Orders) End Sub Dim MyOrders() As Order = Orders.ToArray SuperListBinder.DataBind(MyOrders) '<<Error occurs on this line I don't understand this error. I think that I am passing the appropriate data type to a sub. I don't understand the meaning of "Cannot convert object of type x to an object of type x! Note that, if relevant, my Solution File contains ,multiple projects and that they are all project references. Error: Error 1 Value of type '1-dimensional array of BESI.BusinessObjects.Order' cannot be converted to '1-dimensional array of BESI.BusinessObjects.Orders' because 'BESI.BusinessObjects.Order' is not derived from 'BESI.BusinessObjects.Orders'. C:\My\Code\BESI\BesiAdmin\Forms\Activity.vb 17 34 BesiAdmin

    Read the article

  • siverlight and windows workflow foundation

    - by wissem
    private void btnUpdate_Click(object sender, RoutedEventArgs e) { xxxxxxx.Workflow1_WebServiceSoapClient zer = new xxxxx.Workflow1_WebServiceSoapClient(); zer.demanderSubmitReportCompleted += new EventHandler<xxxxxxxxxxxxxxx.demanderSubmitReportCompletedEventArgs>(service2); zer.demanderSubmitReportAsync("zzz", 20000); } public void service2(object sender, xxxxx.demanderSubmitReportCompletedEventArgs e) { string a = e.Result; } I'm trying to call a windows workflow foundation published as a web service from a Silverlight project. When I call it from a console application it works fine because I can add a web reference then I just make an instance of that webservice then I invoke the method I want. The problem is in the silverlight project cause i can just add a service reference so I find myself working with soap stuff that doesn't work at all, and here is the code error: here is the code error:i change it a litle bit in english Error in exécution Microsoft JScript: Unhandled Error in Silverlight Application exception happened in the operation, résult not valide. Consult InnerException for more information. in System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() in AEDSilverlightIntegrated.ServiceReference2.demanderSubmitReportCompletedEventArgs.get_Result() in AEDSilverlightIntegrated.SilverEntryAedHeaderNew.mmm_demanderSubmitReportCompleted(Object sender, demanderSubmitReportCompletedEventArgs e) in AEDSilverlightIntegrated.ServiceReference2.Workflow1_WebServiceSoapClient.OndemanderSubmitReportCompleted(Object state)

    Read the article

  • Castle Windsor Weak Typed Factory

    - by JeffN825
    In a very very limited number of scenarios, I need to go from an unknown Type (at compile time) to an instance of the object registered for that type. For the most part, I use typed factories and I know the type I want to resolve at compile time...so I inject a Func<IMyType> into a constructor ...but in these limited number of scenarios, in order to avoid a direct call to the container (and thus having to reference Windsor from the library, which is an anti-pattern I'd like to avoid), I need to inject a Func<Type,object>...which I want to internally container.Resolve(type) for the Type parameter of the Func. Does anyone have some suggestions on the easiest/most straightforward way of setting this up? I tried the following, but with this setup, I end up bypassing the regular TypedFactoryFacility altogether which is definitely not what I want: Kernel.Register(Component.For(typeof (Func<Type, object>)).LifeStyle.Singleton.UsingFactoryMethod( (kernel, componentModel, creationContext) => kernel.Resolve(/* not sure what to put here... */))); Thanks in advance for any assistance.

    Read the article

  • Collections in C#

    - by Oghenero
    am converting a vb.net component to c#, i get this error Using the generic type 'System.Collections.ObjectModel.Collection<T>' requires '1' type arguments This is what i did in VB.NET i had this Private _bufferCol As Collection i did this in c# private Collection _bufferCol = new Collection(); My declaration is using Microsoft.VisualBasi; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Collections.ObjectModel; Can any body help me please.

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >