Search Results

Search found 4 results on 1 pages for 'dusda'.

Page 1/1 | 1 

  • WPF: Modifying CollectionView from Dispatcher still throws errors

    - by Dusda
    I have the following bit of code that modifies an observable collection of 'screens' whenever a user leaves. void OnUserLeft(int roomId, int userId, string username) { client.ClientDispatcher.Invoke( (Action<int>)((id) => { Console.WriteLine("Hello before the storm!"); var screensToCheck = client.Screens.Where(s => s.CpuId == id).ToList(); screensToCheck.Each(s => client.Screens.Remove(s)); Console.WriteLine("Hello there!"); }), userId); } This is wrapped in a call to the client's Dispatcher, supposedly to get past the threading issues related to CollectionViews. However, I still get the following exception: This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread. The Dispatcher you see above is set in the WPF application's MainViewModel (we're using MVVM), like so: public Dispatcher ClientDispatcher { get { return Dispatcher.CurrentDispatcher; } }

    Read the article

  • An event for when xVal validation fails?

    - by Dusda
    I have a registration form leveraging xVal to handle all validation on the form. It works really well, with one exception: the user doesn't get feedback because another element on the page (a tip telling the user that their username will be their email address) draws on top of the span element xVal spits out when it notices a problem. If I had a way to detect when xVal has a problem with the email field, I could just toggle the visibility of that tooltip and be on my way, but I'm not sure how to do so. I know that xVal uses jquery.validate.js under the hood; is there an event or something I could tie into to do this?

    Read the article

  • Cannot complete a JSONP call from jQuery to WCF

    - by Dusda
    Okay, I am trying (poorly) to successfully make a JSONP call from jQuery on a test page to a WCF web service running locally, as a cross-domain call. I have, at one point or another, either gotten a 1012 URI denied error, gotten a response but in Xml, or just had no response at all. Currently, the way I have it configured it spits back a 1012. I did not write this web service, so it is entirely possible that I am just missing a configuration setting somewhere, but I've become so frustrated with it that I think just asking on here will be more productive. Thanks guys. Details below. I have a WCF web service with the following method: [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public decimal GetOrderStatusJson(int jobId) I am trying to call this method from a jQuery test page, via a cross-domain JSONP call. <script type="text/javascript"> getJsonAjaxObject( "http://localhost:3960/ProcessRequests.svc/json/GetOrderStatusJson", { "jobId": 232 }); function getJsonAjaxObject(webServiceUrl, jsonData) { var request = { type: "POST", contentType: "application/json; charset=utf-8", url: webServiceUrl, data: jsonData, dataType: "jsonp", success: function(msg) { //success! alert("blah"); }, error: function() { //oh nos alert("bad blah"); } }; $.ajax(request); } </script> Below are the chunks of the web.config I configure for this purpose: <services> <service behaviorConfiguration="MWProcessRequestWCF.ProcessRequestsBehavior" name="MWProcessRequestWCF.ProcessRequests"> <endpoint address="json" behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding" contract="MWProcessRequestWCF.IProcessRequests" /> <endpoint address="" binding="wsHttpBinding" contract="MWProcessRequestWCF.IProcessRequests"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="MWProcessRequestWCF.ProcessRequestsBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> <endpointBehaviors> <behavior name="AspNetAjaxBehavior"> <enableWebScript/> </behavior> </endpointBehaviors> </behaviors>

    Read the article

  • One Controller is Sometimes Bound Twice with Ninject

    - by Dusda
    I have the following NinjectModule, where we bind our repositories and business objects: /// <summary> /// Used by Ninject to bind interface contracts to concrete types. /// </summary> public class ServiceModule : NinjectModule { /// <summary> /// Loads this instance. /// </summary> public override void Load() { //bindings here. //Bind<IMyInterface>().To<MyImplementation>(); Bind<IUserRepository>().To<SqlUserRepository>(); Bind<IHomeRepository>().To<SqlHomeRepository>(); Bind<IPhotoRepository>().To<SqlPhotoRepository>(); //and so on //business objects Bind<IUser>().To<Data.User>(); Bind<IHome>().To<Data.Home>(); Bind<IPhoto>().To<Data.Photo>(); //and so on } } And here are the relevant overrides from our Global.asax, where we inherit from NinjectHttpApplication in order to integrate it with Asp.Net Mvc (The module lies in a separate dll called Thing.Web.Configuration): protected override void OnApplicationStarted() { base.OnApplicationStarted(); //routes and areas AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); //Initializes a singleton that must reference this HttpApplication class, //in order to provide the Ninject Kernel to the rest of Thing.Web. This //is necessary because there are a few instances (currently Membership) //that require manual dependency injection. NinjectKernel.Instance = new NinjectKernel(this); //view model factory. NinjectKernel.Instance.Kernel.Bind<IModelFactory>().To<MasterModelFactory>(); } protected override NinjectControllerFactory CreateControllerFactory() { return base.CreateControllerFactory(); } protected override Ninject.IKernel CreateKernel() { var kernel = new StandardKernel(); kernel.Load("Thing.Web.Configuration.dll"); return kernel; } Now, everything works great, with one exception: For some reason, sometimes Ninject will bind the PhotoController twice. This leads to an ActivationException, because Ninject can't discern which PhotoController I want. This causes all requests for thumbnails and other user images on the site to fail. Here is the PhotoController in it's entirety: public class PhotoController : Controller { public PhotoController() { } public ActionResult Index(string id) { var dir = Server.MapPath("~/" + ConfigurationManager.AppSettings["UserPhotos"]); var path = Path.Combine(dir, id); return base.File(path, "image/jpeg"); } } Every controller works in exactly the same way, but for some reason the PhotoController gets double-bound. Even then, it only happens occasionally (either when re-building the solution, or on staging/production when the app pool kicks in). Once this happens, it continues to happen until I redeploy without changing anything. So...what's up with that?

    Read the article

1