Monday, December 31, 2012

Communication WCF and silverlight5 with big object

Communication WCF and silverlight5 with big object

I'm new to WCF and Silverlight, there is an application with Silverlight client and WCF server, It had been working fine until I added a method which takes a big object as parameter. This object contains 93 properties of type int, bool, string, enum. When it blocks, WCF give error message like this:

The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.

No other message meaningful. All the Timeout and Buffersize in the config file are already set to the maximum value.

I have tried with an other object which contains less properties... I added one by one and it worked.

I found out when there are 72 properties(with enum, bool, string, int) it works, but when I add one more, it doesn't work any more.

I have been struggling during one week until right now, thanks a lot for helping me...

Answers & Comments...

Answer: 1

Try setting all the server-side quotas to the maximum, e.g. something like this:

<bindings>   <basicHttpBinding>     <binding name="MyBasicHttpBinding"          maxReceivedMessageSize="2147483647"         >       <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"           maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />       </binding>    </basicHttpBinding> </bindings>   <services>   <service name="MyWcfService">     <endpoint address="http://myservice..."       binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding"       name="MyBasicHttpBinding" contract="IMyContract" />   </service> </services>  
by : Eugene Osovetskyhttp://stackoverflow.com/users/182155

Answer: 2

In the end we found the solution, for those who have the same problem: it was because that ny defaut, the MaxSessionSize(int the BinaryMessageEncodingBindingElement) of NetTcpBinding is maximun 2048, and we can not add any more, so we have to change into custombing with bigger MaxSessionSize.....

by : Liu Yufanghttp://stackoverflow.com/users/1919410




Opening an image file into WritableBitmap

Opening an image file into WritableBitmap

Here is the problem. I want to open a file from local drives, then make it into a WritableBitmap so i can edit it. But the problem is, i cannot create a WritableBitmap from Uri or something like that. Also i know how to open a file into BitmapImage but i cannot figure out how to open a file as WritableBitmap. Is there way to open a file directly into a WritableBitmap,if there is not, is there a way to convert a BitmapImage to a WritableBitmap? Thanks guys.

Answers & Comments...

Answer: 1

I'm no expert and don't have immediate access to intellisense and whatnot, but here goes...

var fileBytes = File.ReadAllBytes(fileName); var stream = new MemoryStream(fileBytes); var bitmap = new BitmapImage(stream); var writeableBitmap = new WritableBitmap(bitmap); 

Even if not a perfect example this should be enough to point you in the right direction. Hope so.

by : Grant Thomashttp://stackoverflow.com/users/263681

Answer: 2

You can load your image file into a BitmapImage and use that as a source for your WriteableBitmap:

BitmapImage bitmap = new BitmapImage(new Uri("YourImage.jpg", UriKind.Relative)); WriteableBitmap writeableBitmap = new WriteableBitmap(bitmap); 
by : Frédéric Hamidihttp://stackoverflow.com/users/464709

Answer: 3

About Frédéric Hamidi's Answer:

private void btnTest_Click(object sender, RoutedEventArgs e) {     BitmapImage bi = new BitmapImage(new Uri("header.png", UriKind.Relative));      if (bi == null)     {         MessageBox.Show("BitmapImage is null");     }     else     {         WriteableBitmap wb = new WriteableBitmap(bi); // Exception throw on this line         MessageBox.Show(wb.PixelHeight.ToString());     } } 

Exception details:

System.NullReferenceException was unhandled by user code   Message=Object reference not set to an instance of an object.   StackTrace:        at MS.Internal.XcpImports.CheckHResult(UInt32 hr)        at MS.Internal.XcpImports.WriteableBitmap_CreateFromSource(WriteableBitmap wb, IntPtr ptrMemory, BitmapSource source, Boolean& bHasProtectedContent)        at System.Windows.Media.Imaging.WriteableBitmap..ctor(BitmapSource source)        at SilverlightApplication2.MainPage.btnTest_Click(Object sender, RoutedEventArgs e)        at System.Windows.Controls.Primitives.ButtonBase.OnClick()        at System.Windows.Controls.Button.OnClick()        at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)        at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)        at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)   InnerException:  

Project File Structure:

- Project     - MainPage.xmal/cs     - header.png 

I tried this on two different machines (Win7 + Silverlight 5 + Visual Studio 2010 Web Developer Express Edition)

by : Peter Leehttp://stackoverflow.com/users/301336




Making smooth effect in WPF manually in C# with DispatcherTimer

Making smooth effect in WPF manually in C# with DispatcherTimer

I'm trying to make pretty effect with not using Storyboard or another ready/already done stuff in WPF.

I want to make smooth effect, where on some event (like click) the UI element resizes for 2-3 seconds and bluring with changing color. All these items I want to make in smooth pretty way.

I have prepared such class to render each frame of my effect:

public static class ApplicationHelper {         [SecurityPermissionAttribute(SecurityAction.Demand,         Flags=SecurityPermissionFlag.UnmanagedCode)]         public static void DoEvents(DispatcherPriority priority)         {             DispatcherFrame frame = new DispatcherFrame();             DispatcherOperation oper = Dispatcher.CurrentDispatcher.                             BeginInvoke(priority,                             new DispatcherOperationCallback(ExitFrameOperation),                             frame);              Dispatcher.PushFrame(frame);             if (oper.Status != DispatcherOperationStatus.Completed)             {                 oper.Abort();             }         }          private static object ExitFrameOperation(object obj)         {             ((DispatcherFrame)obj).Continue = false;             return null;         }          [SecurityPermissionAttribute(SecurityAction.Demand,         Flags=SecurityPermissionFlag.UnmanagedCode)]         public static void DoEvents()         {             DoEvents(DispatcherPriority.Background);         } } 

Here I'm trying to make it work with DispatcherTimer:

   void vb1_click(object sender, System.Windows.Input.MouseButtonEventArgs e)    {        DispatcherTimer dt = new DispatcherTimer();        dt.Interval = new TimeSpan(0, 0, 0, 0, 500);        dt.Tick += new System.EventHandler(dt_Tick);        dt.Start();    }     void dt_Tick(object sender, System.EventArgs e)    {        for(int i = 0; i < 20; i++)        {            this.vb2_blur_eff.Radius = (double)i;            ApplicationHelper.DoEvents();             }    } 

The main problem is, that when I'm launcing it, I'm only waiting and at the final time ( when must last frame be rendered ) , I'm getting in a very quick speed all frames, but perviously there was nothing.

How to solve it and make perfect smooth effect in pure C# way with not using some ready/done stuff?

Thank you!

Answers & Comments...

Answer: 1

The ApplicationHelper.DoEvents() in dt_Tick probably does nothing, since there are no events to process. At least not the ones you're probably expecting.

If I'm not mistaken, your code will just quickly set the Radius to 0, then 1, 2, and so on in quick succession, and finally to 19. All of that will happen every 500 milliseconds (on every Tick, that is).

I think you might believe that each Tick will only set Radius to one value and then wait for the next Tick, but it does not. Every Tick will set the Radius to all the values, ending at 19. That is one possible explanation for what you're experiencing.

I would also like to comment on the DoEvents approach. It's most likely a bad idea. Whenever I see a DoEvents I get chills up my spine. (It reminds me of some seriously bad Visual Basic 5/6 code I stumbled across 10-15 years ago.) As I see it, an event handler should return control of the GUI thread as quickly as possible. If the operation takes a not insignificant amount of time, then you should delegate that work to a worker thread. And nowadays, you have plenty of options for writing asynchronous code.

by : Christoffer Lettehttp://stackoverflow.com/users/11808




Introduction/tutorial for XAML

Introduction/tutorial for XAML

I'm looking for a good introduction/tutorial for XAML. The Silverlight.Net Quickstarts are very good, but I was wondering what else is out there.

Answers & Comments...

Answer: 1

This site has been good to me, though I feel the guy in the upper right is watching me the whole time.

by : krs1http://stackoverflow.com/users/113921




Windows Phone ListBox Flicking Behaviour

Windows Phone ListBox Flicking Behaviour

All

While scrolling the ListBox to the top, if I still hold my fingure down, the listbox will be compressed a liitle bit but it will flick back as normal while I released the tap. Is it any way to detect this behaviour?

Currently I'm using this code to catch the scroll event, but while the listbox reach the top or the end, the values will always be 0 or as the listbox's heigh even if I do the gesture as above descibed.

void PageLoaded(object sender, RoutedEventArgs e)     {         List<ScrollBar> scrollBarList = GetVisualChildCollection<ScrollBar>(listBox1);         foreach (ScrollBar scrollBar in scrollBarList)         {             if (scrollBar.Orientation == System.Windows.Controls.Orientation.Horizontal)             {                 scrollBar.ValueChanged += new RoutedPropertyChangedEventHandler<double>(horizontalScrollBar_ValueChanged);             }             else             {                 scrollBar.ValueChanged += new RoutedPropertyChangedEventHandler<double>(verticalScrollBar_ValueChanged);             }         }           }      private void horizontalScrollBar_ValueChanged(object sender, RoutedEventArgs e)     {      }      private void verticalScrollBar_ValueChanged(object sender, RoutedEventArgs e)     {         ScrollBar scrollBar = (ScrollBar)sender;         object valueObj = scrollBar.GetValue(ScrollBar.ValueProperty);         object maxObj = scrollBar.GetValue(ScrollBar.MaximumProperty);         if (valueObj != null && maxObj !=null)         {             double value = (double)valueObj;             double max = (double)maxObj;              System.Diagnostics.Debug.WriteLine(value);             System.Diagnostics.Debug.WriteLine(max);         }     }      void btnDelete_Click(object sender, EventArgs e)     {         ((ObservableCollection<String>)listBox1.ItemsSource).Remove("hello1");         listBox1.ScrollIntoView(listBox1.Items[listBox1.Items.Count()-1]);     }      public static List<T> GetVisualChildCollection<T>(object parent) where T : UIElement     {         List<T> visualCollection = new List<T>();         GetVisualChildCollection(parent as DependencyObject, visualCollection);         return visualCollection;     }     private static void GetVisualChildCollection<T>(DependencyObject parent, List<T> visualCollection) where T : UIElement     {         int count = VisualTreeHelper.GetChildrenCount(parent);         for (int i = 0; i < count; i++)         {             DependencyObject child = VisualTreeHelper.GetChild(parent, i);             if (child is T)             {                 visualCollection.Add(child as T);             }             else if (child != null)             {                 GetVisualChildCollection(child, visualCollection);             }         }     } 

Answers & Comments...




loading an external webpage in navigation frame in silverlight

loading an external webpage in navigation frame in silverlight

Problem:
In my silverlight tool, have a <Navigation:frame/> Now want to load Google home page in that frame on click of a button or may be on load..

What I have Tried:
Now I have tried having the source of the frame as "http://www.google.com", dint work, says invalid url, I do not have uri mapping though. And tried on a hyperlink to put NavigateUri="http://www.google.com" TargetName="ContentFrame" like this still no luck.

Intention:
I actually wanted to get the page content in a XML format or some other format so that I can modify the content of google page through code and then populate in the frame.

Need help here.

Answers & Comments...




How to plot list of latitude and longitude present in a file in Bing Map.

How to plot list of latitude and longitude present in a file in Bing Map.

I have created a silverlight application. I have successfully created the map using that. Now my task is to read the data from file1 and plot all the latitude and longitude in red color and then read the data from file2 and plot all the latitude and longitude in blue color.

Answers & Comments...




Silverlight Application Almost Freezes When Loading Images Using WebClient

Silverlight Application Almost Freezes When Loading Images Using WebClient

I have this weird issue.

The code I have on my main thread:

WebClient client = new WebClient(); client.OpenReadCompleted += new OpenReadCompletedEventHandler((ss, ee) => {     Dispatcher.BeginInvoke(() =>     {         try         {             BitmapImage bi = new BitmapImage();             bi.SetSource(ee.Result);             WriteableBitmap wb = new WriteableBitmap(bi);             _okAction.Invoke(linkTexBox.Text, wb);              theProgressBarDialog.Close();         }         catch (Exception)         {             theProgressBarDialog.Close();              string msg = "Cannot fetch the image.  Please make sure the image URL is correct";             MessageBox.Show(msg);         }     }); }); client.OpenReadAsync(new Uri("Image URL without cross domain problem")); theProgressBarDialog.Show(); 

The image is loaded successfully, and got rendered on my canvas.

The weird behavior is sometimes, my whole Silverlight application seems freezing, the app does not respond to any user action EXCEPT the right-click, which pops up the default Silverlight context menu.

The buttons are disabled forcefully.

When debugging, no exception is thrown.

Answers & Comments...




Grid Binding Column Names

Grid Binding Column Names

I am binding a grid with observableCollection of User defined type. My Class has some properties e.g. FirstName, LastName, DateOfBirth etc.

When I am binding Grid. It is displaying the same header i.e. FirstName but I want it to be like First Name.

I am sure there is something to do with attributes on the property in the class but I don't know which attribute should I use.

I have tried Display attribute but it did not work.

Any information will be helpful...

Answers & Comments...

Answer: 1

Not sure if there is a way to do this in xaml, but you could add an EventHandler to and add some logic to change the ColumnHeader text.

xaml:

   <DataGrid ItemsSource="{Binding ...}" AutoGeneratingColumn="DataGrid_AutoGeneratingColumn" /> 

code:

  private void DataGrid_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)   {      e.Column.Header = string.Concat(e.Column.Header.ToString().Select(x => char.IsUpper(x) ? " " + x : x.ToString())).TrimStart(' ');    } 

this will convert Pascal casing to have spaces between uppercase chars eg: "FirstName" = "First Name"

Before

After

by : sa_ddam213http://stackoverflow.com/users/1849109




Paypal in windows phone 7 App

Paypal in windows phone 7 App

I am developing a windows phone 7 application. In my app user can make purchases. The client need to use paypal for payments.

I found paypal APIs for all other phones (IPhone, Android, Blackberry). But there is no API for windows phone. Is windows phone support paypal ?. Is there any other alternative method if there is no paypal API for windows phone ?

Thanks

Answers & Comments...

Answer: 1

I think in-app purchasing currently is not available for Windows Phone 7.5.

This wil be the feature of WP8 exclusively!

by : domozihttp://stackoverflow.com/users/1182277

Answer: 2

I'm having the same problem :-( Currently I think of selling codes via a website and then the user could enter the code in the app. Inconvenient, but should be working. Even though I don't know any technical reason why MS restricts the inapp-payment to WP 8 :-(

by : K232http://stackoverflow.com/users/672756

Answer: 3

We can use paypal in windows phone by the Mobile Express Checkout method with the help of a webbrowser control. I implemented and succeeded the paypal implementation in windows phone.

https://www.x.com/developers/paypal/documentation-tools/express-checkout/gs_expresscheckout

https://www.x.com/developers/paypal/products/mobile-express-checkout

Hope the above links will help others too to implement paypal in windows phone 7.

Thanks

by : Arunhttp://stackoverflow.com/users/1063254




OutOfMemoryException when trying to add items to ItemsControl when load in ItemsControl more items

OutOfMemoryException when trying to add items to ItemsControl when load in ItemsControl more items

I have a ItemsControl with ScrollViewer it shows newfeed. Answer why i do not use ListBox. I show 40-50 news, and then, I push the button, which updates newsfeed collection, and then - put it in ItemsControl. But I have OutOfMemoryException, and I can understand why. The method i use to get more newsfeed is the same method which loads data firsttime, so i think problem is not in it. But here is the code

        void c_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)     {         XDocument xml = XDocument.Load(e.Result);          App.WriteToIsoStorage(xml.ToString(), "items.xml");         App.New_From = (string)xml.Element("response").Element("new_from").Value;         var inf = from c in xml.Descendants("item")                    select c;         foreach (var item in inf)         {             if ((string)item.Element("type").Value != "friend" && item.Element("type").Value != "photo_tag" && (string)item.Element("type").Value != "photo" && item.Element("type").Value != "wall_photo")             {                 New new1 = new New();                 GetIds(item, new1, out new1);                 GetIcons(item, new1, out new1);                 if (item.Element("attachment") != null)                 {                     var vd = from c in item.Descendants("attachment")                                 select c;                     foreach (var content in vd)                     {                         if (content.Element("audio") != null) GetAudios(content, new1.audioAttachments, out new1.audioAttachments);                         if (content.Element("photo") != null && (string)item.Element("type").Value != "photo" && item.Element("type").Value != "wall_photo") GetPhotos(content, new1.photoAttachments, out new1.photoAttachments);                         if (content.Element("video") != null) GetVideos(content, new1.videoAttachments, out new1.videoAttachments);                         if (content.Element("link") != null) GetUrls(content, new1, out new1);                     }                 }                 if (item.Element("type").Value != "photo" && item.Element("type").Value != "wall_photo" && item.Element("type").Value != "photo_tag")                 NewsList.Add(new1);                 this.ItemsControl.Items.Add(new1);                 new1 = null;             }              IEnumerable<XElement> profiles = from c in xml.Descendants("user") //                                                  select c;             IEnumerable<XElement> groups = from c in xml.Descendants("group") //                                                  select c;             GetNames(profiles, groups);           }     } 

and here what VS shows .

Answers & Comments...




Can I expand downloading images to several threads?

Can I expand downloading images to several threads?

I had a problem with ListBox, which doesn't work fine with my collection (nested listboxes, non static size, etc). I tried DeferredLoadListBox, but it requires static height(not my variant).

So, I tried ItemsControl with ScrollViewer, and it works realy good! I have smooth scrolling, no lags, its exactly what i needed. But! As I understand, ListBox download content dynamically, only when it need this content, and ItemsControl loads all the content in one time.

And its a problem, because I load in ItemsControl a collection of 40-50 items, and each item has 1-4 images, and it takes about 5-6 seconds(than ItemsControl works great). As I understand - in this 5-6 seconds it downloads all the images. Question - is there any way to expand this operation to several threads, and using this hint reduce the ItemsControl's freezing?

Answers & Comments...

Answer: 1

Just use LowProfileImageLoader with the standard ListBox

by : Igor Kulmanhttp://stackoverflow.com/users/581164




How can I deserialize with TypeNameHandling.Objects in Json.NET Silverlight?

How can I deserialize with TypeNameHandling.Objects in Json.NET Silverlight?

I get an exception when trying to deserialize in Silverlight. Test1 fails, while Test2 succeeds. I've also tried TypeNameAssemblyFormat to both Simple and Full, but get same results. Test2 can resolve the assembly, why can't Json.NET?

Update: Forgot to mention the type I'm trying to deserialize is defined in a different assembly from the silverlight assembly where the deserialization occurs.

Both tests work in a non-silverlight .NET application.

How can I deserialize a json string that has typenames?

private void Test1() {     JsonSerializerSettings settings = new JsonSerializerSettings();     settings.TypeNameHandling = TypeNameHandling.Objects;     string json1 = "{\"$type\":\"AmberGIS.NetworkTrace.DTO.NTPoint, NetworkTrace.DTO.Assembly\",\"X\":0.0,\"Y\":0.0,\"SpatialReference\":null}";     try     {         var n1 = JsonConvert.DeserializeObject<NTPoint>(json1, settings);         //Error resolving type specified in JSON 'AmberGIS.NetworkTrace.DTO.NTPoint, NetworkTrace.DTO.Assembly'.         //Could not load file or assembly 'NetworkTrace.DTO.Assembly, Culture=neutral, PublicKeyToken=null' or one of its dependencies.          //The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest.          //(Exception from HRESULT: 0x80131053)     }     catch (Exception ex)     {         while (ex != null)         {             Debug.WriteLine(ex.Message);             ex = ex.InnerException;         }     } } 

This Test2 succeeds:

private void Test2() {     var pnt1 = new AmberGIS.NetworkTrace.DTO.NTPoint();     Debug.WriteLine(pnt1.GetType().AssemblyQualifiedName);     // "AmberGIS.NetworkTrace.DTO.NTPoint, NetworkTrace.DTO.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"      string fullName = "AmberGIS.NetworkTrace.DTO.NTPoint, NetworkTrace.DTO.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";     var t = Type.GetType(fullName);     var pnt2 = Activator.CreateInstance(t) as NTPoint;  } 

Answers & Comments...

Answer: 1

I resolved my issue by downloading source for Json.NET 4.0r2, and adding 2 lines of hack code to DefaultSerializationBinder.cs, as shown below. This probably won't work for strong named assemblies. Silverlight lacks a method to scan the appdomain for loaded assemblies, see here.

#if !SILVERLIGHT && !PocketPC         // look, I don't like using obsolete methods as much as you do but this is the only way         // Assembly.Load won't check the GAC for a partial name #pragma warning disable 618,612         assembly = Assembly.LoadWithPartialName(assemblyName); #pragma warning restore 618,612 #else           // **next 2 lines are my hack** ...           string fullName = String.Format("{0}, {1}, Version=1.0.0.0,  Culture=neutral, PublicKeyToken=null",typeName,assemblyName);           return Type.GetType(fullName);          assembly = Assembly.Load(assemblyName); 

silverlight slider flow direction for vertical orientation

silverlight slider flow direction for vertical orientation

Is there a way to change the flow direction of the slider for the vertical orientation? If not, is there a way to change the background color to a color without it having that weird shaded effect? I want the bright color of the slider to be on top and the shaded portion to be on the bottom.

Answers & Comments...

Answer: 1

Thanks for all the great responses, but I ended up solving this one on my own. After much research, I finally discovered that I should edit the slider's template and that it can be easily done in Expression Blend. I found a pretty good tutorial for editing templates here. Once I started editing the template, I went to the vertical fill portion of the vertical slider and changed the transparency to 20% and changed the vertical track portion of the the vertical slider to 100%. This is where the shaded effect comes from. Then, I just switched the Fill properties for the vertical fill and the vertical track, so that the top part would be referenced by the slider's Foreground property and the bottom (now shaded part) would be referenced by the slider's Background property.

by : Thick_propheThttp://stackoverflow.com/users/1296733




silverlight tsql spatial insert wcf reports no error but does not insert

silverlight tsql spatial insert wcf reports no error but does not insert

this insert works correctly:

        string WKT = "LINESTRING (" + POINTS[0].Longitude.ToString(CultureInfo.InvariantCulture)             + " " + POINTS[0].Latitude.ToString(CultureInfo.InvariantCulture);         for (int i = 1; i < POINTS.Count; i++)         {             WKT += ", " + POINTS[i].Longitude.ToString(CultureInfo.InvariantCulture)             + " " + POINTS[i].Latitude.ToString(CultureInfo.InvariantCulture);         }         WKT += ")";          HydroWCF.HydrotamServisClient cli = new HydroWCF.HydrotamServisClient();         cli.ExecuteNonQueryCompleted += new EventHandler<HydroWCF.ExecuteNonQueryCompletedEventArgs>(cli_ExecuteNonQueryCompleted);          string q = "";         if (kaydetmeBicimi == "I")         {             q += " INSERT INTO [HydrotamDB].[dbo].[Kiyi]";             q += "        ([BolgePtr]";             q += "        ,[Ad]";             q += "        ,[Bilgi]";             q += "        ,[ZoomLevel])";             q += "  VALUES";             q += "        (" + bolgeList[cbBolge.SelectedIndex].BolgeID;             q += "        ,'" + kiyiAdi + "'";             q += "        ,'" + WKT + "'";             q += "        ," + viewMap.ZoomLevel + ")";         }         else         {             q += " UPDATE [HydrotamDB].[dbo].[Kiyi]";             q += "        SET [BolgePtr]= " + bolgeList[cbBolge.SelectedIndex].BolgeID;             q += "        ,[Ad] = '" + kiyiAdi + "'";             q += "        ,[Bilgi] = '" + WKT + "'";             q += "        ,[ZoomLevel]=" + +viewMap.ZoomLevel;             q += " WHERE ID = " + kiyiList[cbKiyi.SelectedIndex].KiyiID;          }         cli.ExecuteNonQueryAsync(q); 

but this one doesn't:

        HydroWCF.HydrotamServisClient cliKaydet = new HydroWCF.HydrotamServisClient();         cliKaydet.ExecuteNonQueryCompleted +=new EventHandler<HydroWCF.ExecuteNonQueryCompletedEventArgs>(cliKaydet_ExecuteNonQueryCompleted);          string WKT = "POINT (" + currNokta.NoktaLoc.Longitude.ToString(CultureInfo.InvariantCulture)              + " " + currNokta.NoktaLoc.Latitude.ToString(CultureInfo.InvariantCulture);         WKT += ")";          string q = "";         q += " INSERT INTO EnerjiNokta(Ad, Yer)";         q += " VALUES( '" + currNokta.NoktaAdi + "', '" + WKT + "' );";          cliKaydet.ExecuteNonQueryAsync(q); 

any solution would be appreciated! Second INSERT does not report any error, and when I copy q to sql manager query runs correctly and insert point as expected. TIA

Answers & Comments...




How can I grab results from a query even if an SQL exception occurs during command.executeReader()?

How can I grab results from a query even if an SQL exception occurs during command.executeReader()?

I have this slice of code that works sometimes and sometimes not. The query that is being executed has not been written by myself, but I am told that all I have to do is run it against the database to get the results I need. Here is my code:

try {   using (SqlDataReader dr = cmd.ExecuteReader()) {     while (dr.Read()) {       try {         list.Add(dr.GetString(3) + " " + dr.GetInt32(4).ToString() + " " + dr.GetString(5) + " " + dr.GetDecimal(8).ToString());       } catch (Exception e) {         list.Add("fail");       }     }   } } catch (SqlException sqlException) {   Debug.WriteLine(sqlException.Message); } 

The error that I sometimes receive is that I cannot drop a table because I do not have permission or the table does not exist. Other times the query executes without any problems and I am able to retrieve and store my results in a list.

When I run the query in SQL Server 2008, sometimes I do indeed get errors but the results still show up and are what I expect. So my question is: How can I grab these results regardless of the error that seems to come up whenever it feels like?

Here is a tiny piece of the query that is causing me my troubles:

IF  EXISTS (SELECT * from tempdb..sysobjects where name like '#TABLE%')   DROP #TABLE 

There are many of these if statements in the query that i am running and it's unpredictable which one is going to cause an error. So what i have done for right now is surround the DROP #TABLE in a try-catch block so that at least i can still get retrieve the results in my silverlight program. I will get with my higher up and ask him why the query is returning these errors spontaneously..

Answers & Comments...

Answer: 1

EDIT

Never mind, I see the problem. I forgot that temp table names are appended with additional characters to prevent naming conflicts between different processes (e.g. #TABLE___...___0000000064E2).

My guess is that the stored proc is creating a temp table named "#TABLE" under certain circumstances and the bit of SQL code you posted is meant to perform the cleanup. When running by itself, this probably works fine.

The problems probably begin to materialize when the stored proc is run by several clients simultaneously, or if one of the previous queries somehow failed to perform the cleanup (perhaps due to an error halfway through). Under those circumstances, a false positive is created (where the stored proc thinks the cleanup is necessary, but it's actually seeing the temp table created by another process). Then you get the error because there's no #TABLE associated with the current process.

In any case, wrapping the statement in a try-catch seems like a decent approach. A better approach would involve an overhaul of your code, perhaps setting a flag of some sort to help indicate that a cleanup is necessary or using a common table and some sort of transaction key (deleting all records associated with the current transaction, rather than dropping the table).

You might also want to consider using a table variable instead of a temp table.

See:
http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/02337dd5-5cfd-40d8-b529-12dc557d6a7e/

Or, you might also consider skipping the DROP statement entirely:
Temporary Table Scope?


To answer your original question, I am not aware of any way to retrieve results from a SQL Query once it has thrown an exception, not via the .NET assemblies, anyway. SQL Server Management Studio uses some heavy-duty, custom-made APIs which probably would not be worth your trouble to learn and use.


Ignore the following
(Preserved for reference)

If you can, try changing the SQL Query to

IF  EXISTS (SELECT * from tempdb..sysobjects where name = '#TABLE') DROP #TABLE 

(Changed like '#TABLE%' to = '#TABLE')

The like statement doesn't make any sense... it doesn't matter if there are other tables starting with "#TABLE"... you only want to know if there's a table named exactly "#TABLE".

My guess is that this is one of those cases where the logic was changed, but only half-way, maybe by two different people.

by : Cyborgx37http://stackoverflow.com/users/211627




Autocompletebox SelectedText Bug

Autocompletebox SelectedText Bug

I want to bind both the SelectedText and SelectedItem properties of an AutocompleteBox because my client wants to be able to input text and select from the list also. It's working properly but ...

The MainPage has one DataGrid. When I select a record from the Grid (i.e. SelectedItem), I want to set it in a popup window's AutocompleteBox. Some times it works but some times it doesn't.

What should I do for this issue?

This is my XAML:

<customTookit:AutoCompleteBox Grid.Column="3" Grid.Row="3" Height="18" Width="150"       IsTextCompletionEnabled="True" TabIndex="9" HorizontalAlignment="Left"      IsPopulated="{Binding ElementName=ResEdit,Path=DataContext.IsDrop,Mode=TwoWay}"      Text="{Binding ElementName=ResEdit,Path=DataContext.SelectedDemoText,Mode=TwoWay}"      ItemsSource="{Binding ElementName=ResEdit,Path=DataContext.DemoList,Mode=OneWay}"      ItemTemplate="{StaticResource DemoTemplate}"      ValueMemberPath="DemoCode"       LostFocus="AutoCompleteBox_LostFocus_1"      Margin="0,0,21,0" Padding="0">   </customTookit:AutoCompleteBox> 

This property is in my view-model and bound to the DataGrid:

public InvoicesDTO SelectedInvoice {     get { return _selectedInvoice; }     set     {         SelectedInvoice = value;         SelectedDomoText = SelectedInvoice.DemoText.Trim();         RaisePropertyChanged("SelectedInvoice");     } } 

Answers & Comments...




Connecting two dynamically created shapes using line shape in silverlight

Connecting two dynamically created shapes using line shape in silverlight

Im working on flowchart kind of application in asp.net using silverlight.. Im a beginner in Silvelight, Creating the elements (Rectangle,Ellipse,Line.. ) dynamically using SHAPE and LINE Objects in codebehind (c#)

These shapes will be generated dynamically, meaning I'll be calling a Web service on the backend to determine how many objects/shapes need to be created. Once this is determined, I'll need to have the objects/shapes connected together.

how to connect dynamically created shapes with a line in Silverlight like a flowchart.

I read the below article, but its not working for me, actualHeight & actualWidth of shapes values are 0. Connecting two shapes together, Silverlight 2

here is my MainPage.xaml

<UserControl x:Class="LightTest1.MainPage">  <Canvas x:Name="LayoutRoot" Background="White">     <Canvas x:Name="MyCanvas" Background="Red"></Canvas>     <Button x:Name="btnPush" Content="AddRectangle" Height="20" Width="80" Margin="12,268,348,12" Click="btnPush_Click"></Button>                </Canvas> 

code behind MainPage.xaml.cs

    StackPanel sp1 = new StackPanel();      public MainPage()     {         InitializeComponent();         sp1.Orientation = Orientation.Vertical;         MyCanvas.Children.Add(sp1);     }      Rectangle rect1;     Rectangle rect2;     Line line1;      private void btnPush_Click(object sender, RoutedEventArgs e)     {         rect1 = new Rectangle()         {             Height = 30,             Width = 30,             StrokeThickness = 3,             Stroke = new SolidColorBrush(Colors.Red),         };         sp1.Children.Add(rect1);                     rect2 = new Rectangle()         {             Height = 30,             Width = 30,             StrokeThickness = 3,             Stroke = new SolidColorBrush(Colors.Red),         };         sp1.Children.Add(rect2);          connectShapes(rect1, rect2);     }      private void connectShapes(Shape s1, Shape s2)     {         var transform1 = s1.TransformToVisual(s1.Parent as UIElement);         var transform2 = s2.TransformToVisual(s2.Parent as UIElement);          var lineGeometry = new LineGeometry()           {               StartPoint = transform1.Transform(new Point(1, s1.ActualHeight / 2.0)),               EndPoint = transform2.Transform(new Point(s2.ActualWidth, s2.ActualHeight / 2.0))           };           var path = new Path()         {             Data = lineGeometry,             Stroke = new SolidColorBrush(Colors.Green),         };         sp1.Children.Add(path);               } 

what I am doing in button click event is just adding two rectangle shapes and tring to connect them with a line (like flowchart). Please suggest what is wrong in my code..

Answers & Comments...

Answer: 1

Try replacing the line

    connectShapes(rect1, rect2); 

with

    Dispatcher.BeginInvoke(() => connectShapes(rect1, rect2)); 

I'm not sure of the exact reason why this works, but I believe the shapes are only rendered once control passes out of your code, and only once they are rendered do the ActualWidth and ActualHeight properties have a useful value. Calling Dispatcher.BeginInvoke calls your code a short time later; in fact, you may notice the lines being drawn slightly after the rectangles.

The TransformToVisual method behaves in much the same way as the ActualWidth and ActualHeight properties. It will return an identity transformation if the shape hasn't been rendered. Even if your lines were being drawn with a definite width and height, they would end up being drawn all on top of one another at the top-left.

I also found that I needed to add the lines to the Canvas, not the StackPanel, in order for them to be drawn over the rectangles. Otherwise the StackPanel quickly filled up with lines with a lot of space above them.

by : Luke Woodwardhttp://stackoverflow.com/users/48503




Class Library in Lightswitch

Class Library in Lightswitch

I am developing an application with this new Lightswitch from Microsoft.

It is really nice to design screens and connect them with databases but at this point I have to send some messages to our RabbitMQ queue and for that I need to be able to add some C# Class Libraries (like protobuf, rabbitmq, log4net and so on) to create the subscriber and shared classes and objects.

So far I understand that Lightswitch is based on Silverlight and it has only 20 percent of the actual .NET Framework and has other engine then CLR and limited capabilites.

But I am really stuck here, I'd be appreciated for some ideas.

Thanks.

Answers & Comments...

Answer: 1

While what you want to do IS possible, it's certainly not as easy as "all you need do is add references to your assemblies within the LS Client project and then work with any types you defined within those referenced assemblies and you are good as gold".

You can't use .NET assemblies in the client (as you noted, the client is based on Silverlight at the moment). LightSwitch doesn't have a direct way for the Silverlight client to access .NET assemblies, but they can be used in the Server project.

There's a technique, that a number of us refer to as the "command table pattern" (though it's not an official pattern as such). What this involves is having a "command" table (or an "action" table, or a "dummy" table, it doesn't matter what it's called), to which you can programatically add & save a record from the client tier, then intercept the saving of that "dummy" record in the server tier, allowing you to "tirgger" the use of any .NET code you mmight need to use.

It's certainly not as straightforward as it could be (hopefull this will be addressed in future versions), but it does allow you to get around any restrictions that Silverlight might be causing you. I'd be interested to hear where you got the 20% figure from, I've never heard of that before, & I doubt that Silvelight's functionality, compared to .NET, is that low.

by : Yann Duranhttp://stackoverflow.com/users/281489




Tab Navigation on Virtualized Items Panel

Tab Navigation on Virtualized Items Panel

How can you set the Tab Navigation on virtualized items? As example;

        <ListBox x:Name="Items">                     <ListBox.Template>                 <ControlTemplate>                     <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">                         <ItemsPresenter/>                                </ScrollViewer>                          </ControlTemplate>                   </ListBox.Template>             <ListBox.ItemsPanel>                 <ItemsPanelTemplate>                     <VirtualizingStackPanel VirtualizingStackPanel.VirtualizationMode="Recycling"/>                          </ItemsPanelTemplate>                    </ListBox.ItemsPanel>             <ListBox.ItemTemplate>                 <DataTemplate>              <Button />                 </DataTemplate>                      </ListBox.ItemTemplate>                    </ListBox> 

If I set TabNavigation=Once or Cycle on the Scrollviewer itself, or the Listbox parent etc, it only tabs through items available in the viewport since the others haven't been generated yet. Is there a trick someone might share for when tabbing through Item Objects it will allow Tab to proceed to the next not-yet-virtualized item while bringing it to view in the viewport and providing intuitive tabbing through the controls?

Answers & Comments...

Answer: 1

I Think this link halpful not sure

MSDN

Link

by : Jignesh.Rajhttp://stackoverflow.com/users/1928157




Error with Microsoft Silverlight Analytics Framework (MSAF) and Google Analytics with Marketplace Test Kit

Error with Microsoft Silverlight Analytics Framework (MSAF) and Google Analytics with Marketplace Test Kit

The title explains itself. I know there have been more people with this issue and I couldn't find a solution.

I read that a popup was required to be closed, but I don't know where this popup is or what to do.

Error: Pressing back button in "MainPage.xaml" does not close the dialog box.

It actually appears in all my pages.

Thanks in advance.

Answers & Comments...




Google App Engine on Silverlight

Google App Engine on Silverlight

are there any good examples on how to use Google App Engine from Silverlight, preferably without writing custom webservices?

Cheers

Nik

Answers & Comments...

Answer: 1

I'm thinking about doing the same thing, but I've not come across anything yet.

I'm thinking about using JSON.net for the comms, so basically writing a REST service in GAE for the client to call, and maybe OAuth.NET for the authentication (unless I can find the .NET port of the google one, I've not looked yet)

Silverlight is basically just .NET, tho a lite version of it, so if you can find .NET code to do something, it should work, atleast somewhat, in SL :)

But thats as far as I've got - thinking about it. Sorry, can't be of more help yet!

by : Nic Wisehttp://stackoverflow.com/users/2947

Answer: 2

I'm looking at this also. There are several REST projects for GAE, I haven't tried any of them out yet, but hope to in the next week or so.

http://code.google.com/p/app3/

http://code.google.com/p/gae-json-rest/

http://code.google.com/p/appengine-rest-server/

by : Leroyhttp://stackoverflow.com/users/11085

Answer: 3

Check this out:

http://www.informit.com/articles/article.aspx?p=1354698

by : Neo42http://stackoverflow.com/users/125062

Answer: 4

Download the demo for Expression Blend. Check the included tutorial which shows how to create a gorgeous Silverlight interface in GUI mode and integrate it with the Bing search web service. Manipulating this example into a Google example should be trivial. Good luck! :)

by : danglundhttp://stackoverflow.com/users/134850

Answer: 5

Here is my approach based heavily on Scott Seely's post Simply passes XML around, .xap is also served by GAE. I only just got this working yesterday so it is still work in progress.

Google:

app.yaml

    application: wowbosscards version: 1 runtime: python api_version: 1  handlers: - url: /WowBossCards.html   static_files: WowBossCards.html   upload: WowBossCards.html   mime_type: text/html - url: /clientaccesspolicy.xml   static_files: clientaccesspolicy.xml   upload: clientaccesspolicy.xml   mime_type: text/xml - url: /WowBossCards.xap   static_files: WowBossCards.xap   upload: WowBossCards.xap   mime_type: application/x-silverlight-app - url: .*   script: wowbosscards.py 

wowbosscards.py

#!/usr/bin/env python  import cgi import datetime import wsgiref.handlers import os import logging import string import urllib  from google.appengine.ext import db from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp import template  class Xml(db.Model):   xmlContent = db.TextProperty()   date = db.DateTimeProperty(auto_now_add=True)   class XmlCrud(webapp.RequestHandler):   def get(self, xmlType):      xmlKey = string.capitalize(xmlType)     xml = Xml.get_by_key_name(xmlKey)     self.response.headers['Content-Type'] = "application/xml"      self.response.out.write(xml.xmlContent)    def post(self, xmlType):      logging.debug("XmlCrud POST")     xmlKey = string.capitalize(xmlType)     xml = Xml.get_by_key_name(xmlKey)     if len(self.request.get('content')) > 0 :         xml.xmlContent = self.request.get('content')     else:         xml.xmlContent = self.request.body     xml.put()      self.redirect('/upload/' + xmlType)   def main():   Xml.get_or_insert("Bosses", xmlContent="<a>Bosses go here</a>")   Xml.get_or_insert("Dungeons", xmlContent="<a>Dungeons go here</a>")   application = webapp.WSGIApplication([     									  (r'/xml/(.*)', XmlCrud),     									], debug=True)   wsgiref.handlers.CGIHandler().run(application)   if __name__ == '__main__':   main() 

Silverlight:

private class RequestExtended {     public VoidCall CallBack;     public WebRequest Request;     public Uri Host;      public RequestExtended(WebRequest request, VoidCall callBack, Uri host)     {         Request = request;         CallBack = callBack;         Host = host;     } }  public static void ImportFromGoogle(Uri host, VoidCall callBack) {     try     {         if (host.Host == "localhost")         {             host = new Uri(host.Scheme + @"://" + host.Host + ":8080");         }         var bossesCrud = new Uri(host, "/xml/bosses");         var bossesRequest = WebRequest.Create(bossesCrud);         bossesRequest.BeginGetResponse(BossesResponse, new RequestExtended(bossesRequest, callBack, host));     }     catch (Exception ex)     {      } }  public static void BossesResponse(IAsyncResult result) {     var requestExtended = result.AsyncState as RequestExtended;     try     {         WebResponse response = requestExtended.Request.EndGetResponse(result);         Stream responseStream = response.GetResponseStream();          byte[] bytes = new byte[response.ContentLength];         responseStream.Read(bytes, 0, bytes.Length);         responseStream.Close();          var enc = new System.Text.UTF8Encoding();         string xml = enc.GetString(bytes, 0, bytes.Length);          bosses = GetCollectionFromXmlString<BossCollection>(xml);          if (requestExtended.CallBack != null) requestExtended.CallBack();     }     catch (WebException we)     {         HttpWebResponse response = (HttpWebResponse)we.Response;         response.Close();     }     catch (Exception e)     {     } }     public static void SaveBossesToGoogle(Uri host) {     if (host.Host == "localhost")     {         host = new Uri(host.Scheme + @"://" + host.Host + ":8080");     }     var bossesCrud = new Uri(host, "/xml/bosses");     var request = WebRequest.Create(bossesCrud);     request.Method = "POST";     request.ContentType = "text/xml"; //"application/x-www-form-urlencoded";      request.BeginGetRequestStream(GetSaveBossesRequestStreamCallback, new RequestExtended(request, null, host)); }  static void GetSaveBossesRequestStreamCallback(IAsyncResult result) {     var requestExtended = result.AsyncState as RequestExtended;     try     {         Stream stream = requestExtended.Request.EndGetRequestStream(result);         var xmlSerializer = new XmlSerializer(typeof(BossCollection));         var xmlText = new StringBuilder();          using (TextWriter textWriter = new StringWriter(xmlText))         {             xmlSerializer.Serialize(textWriter, Store.Bosses);             textWriter.Close();         }          var enc = new System.Text.UTF8Encoding();         var bytes = enc.GetBytes(xmlText.ToString());          stream.Write(bytes, 0, bytes.Length);         stream.Close();         requestExtended.Request.BeginGetResponse(SaveResponse, requestExtended);     }     catch (WebException we)     {         HttpWebResponse response = (HttpWebResponse)we.Response;         response.Close();     } }   static void SaveResponse(IAsyncResult result) {     var requestExtended = result.AsyncState as RequestExtended;     try     {         WebResponse response = requestExtended.Request.EndGetResponse(result);         if (requestExtended.CallBack != null) requestExtended.CallBack();     }     catch (WebException we)     {         HttpWebResponse response = (HttpWebResponse)we.Response;         response.Close();     } } 
by : Sam Mackrillhttp://stackoverflow.com/users/18349

Answer: 6

I couldn't find any examples getting Silverlight to work with google app's Java SDK, so here is my post.

by : Keld Ølykkehttp://stackoverflow.com/users/0




Silverlight: convert UIElement to SVG

Silverlight: convert UIElement to SVG

I am looking for the best way of converting UIElement(FrameworkElement) to vector format (vector analog for WritableBitmap). The easiest way that comes to mind is manually create special SVG converter for some of UIElement implementations and try to get full vector image.

Generally it will be used for converting Canvases with Shapes.

Any ideas how to do this best way?

Answers & Comments...

Answer: 1

Check out http://sanpaku72.blogspot.com/2007/09/having-fun-with-xaml-silverlight-and.html

It has a link to http://members.chello.nl/~a.degreef/xaml/xaml2svg.xsl and download the other xsl files by following the includes, like http://members.chello.nl/~a.degreef/xaml/xaml2svg/animation.xsl

by : Aleksandr Dubinskyhttp://stackoverflow.com/users/1151521




WP7 XAML Bind to property in parent

WP7 XAML Bind to property in parent

I'm writting an app in WP7 (Silverlight 3). I have a view model that looks like this

public class MainViewModel {    public List<ActivityTypes> ActivityTypes{get;set;}    public RelayCommand LoadActivity{get;set;} } 

My pages datacontext is set to the view model and I have a listbox with it's item source set to the ActivityTypes collection. In the listbox I'm trying to render a list of buttons who's command is bound to the LoadActivity property on the viewmodel. RelayCommand is part of the MVVM Light toolkit in case you are wondering what it is.

The problem I am having is I can't find a way to bind my button command to the LoadActivity property as my listbox has it's itemsource set to the Activitytypes collection and this property is in the parent. I've read about FindAncester but it doesn't look like this is supported in Silverlight 3.

My XAML looks like this

    <UserControl.Resources>         <DataTemplate x:Key="ActivityTypeListTemplate">             <StackPanel>                 <Button Command="{Binding LoadActivity}"> <!--binding not found as we're in the collection-->                     <TextBlock Text="{Binding Name}" FontSize="50"/>                 </Button>             </StackPanel>         </DataTemplate>     </UserControl.Resources>      <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">         <ListBox Margin="0" ItemsSource="{Binding ActivityTypes}" ItemTemplate="{StaticResource ActivityTypeListTemplate}"/>     </Grid> 

What's the best way to code something like this?

Answers & Comments...

Answer: 1

There is no "direct" way to do this. You can set the Buttons DataContext to your MainViewModel (preferably as a StaticResource link) and the it would work.

Take a look at Bind to parent object in xaml

by : Igor Kulmanhttp://stackoverflow.com/users/581164




WP Programmatically move the ScrollViewer

WP Programmatically move the ScrollViewer

I have a ScrollViewer and I'm filling it with controls for about 2 screen heights. At the bottom I have a button which clears the ScrollViewer and refills it with different controls. The problem is when I refill it, the scroll distance remains where my button was. I need the ScrollViewer to scroll up to the top. How can I do that?

Answers & Comments...

Answer: 1

You would need to use the ScrollToVerticalOffset method of the ScrollViewer.

myScrollViewer.ScrollToVerticalOffset(0); 
by : Aaron McIverhttp://stackoverflow.com/users/215030




SL5 + Prism 4.1 Dynamic XAP download takes too much time to load

SL5 + Prism 4.1 Dynamic XAP download takes too much time to load

I am using SL5, Telerik SL5 DLLs, Prism4.1 & MEF for my application and I have splitted my main application into smaller modules. And also, i have enabled "Reduce XAP size by enabling in application library caching" that reduced size of my main xap file from 1.5MB to 700 KB (and also, module1.xap & module2.xap files sizes are reduced to 91 KB & 145 KB).

Problem: When i try to browse through my application over internet, my main xap file gets downloaded immediately (it shows 100% loaded with in 5 - 10 seconds) but the problem is, it is taking little more time (sometimes, it takes more time than main.xap loading took) to load and display first screen from module1.xap. I am unable to figure out the root cause of the issue. Can somebody assist me in resolving this issue?

FYI, Refer below for my clienbin contents:

enter image description here

Main.xap file contents:

enter image description here

Module1.xap file contents:

enter image description here

Module2.xzp file contents:

enter image description here

Answers & Comments...

Answer: 1

Try to use Fiddler or the Developer Tools of your favorite browser to see what and when your application loads modules and external parts.

I think you get the delay cause the Telerik zips (External Parts) are loaded when you navigate to the first screen of module 1.

To reduce the load time you could rezip all .zip files with a better compression tool. I´m using 7zip with Ultra compression to reduce the size of the zip files.

by : Jehofhttp://stackoverflow.com/users/83039

Answer: 2

if you want to load modules by order, you should depend modules one to another. You can do this in modulecatalog.xaml like this

<Modularity:ModuleInfo Ref="Main.xap" ModuleName="Main" ModuleType="Project.Main, Module, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" >         <Modularity:ModuleInfo.DependsOn>             <sys:String>Module1</sys:String>         </Modularity:ModuleInfo.DependsOn> 

by : bayramucuncuhttp://stackoverflow.com/users/554271




Load images in listbox only when it is not scrolling [closed]

Load images in listbox only when it is not scrolling [closed]

How to make subject? I think I saw the solution just in few strings of code, but now I can't find it.

Answer

No Answer and comments so far




SilverLight Connect to NetTcp WCF Hosted inWindows Service

SilverLight Connect to NetTcp WCF Hosted inWindows Service

I have a WCF Service that Hosted in Windows Service

It uses NetTCPBinding and i could connect, i want to implement new Silverlight client to access the service

i have walk through the normal way to add service reference, and it was added with Empty "ServiceReferences.ClientConfig"

so i have viewed some threads and topics, at last i have write my configuration manually for the service

when i try to connect it show's this exception Could not connect to net.tcp://localhost:4502/MyService/Service. The connection attempt lasted for a time span of 00:00:02.2111265. TCP error code 10013: An attempt was made to access a socket in a way forbidden by its access permissions.. This could be due to attempting to access a service in a cross-domain way while the service is not configured for cross-domain access. You may need to contact the owner of the service to expose a sockets cross-domain policy over HTTP and host the service in the allowed sockets port range 4502-4534.

i believe that the problem related to ClientAccessPolicy.xml file

after search people say i need to have IIS7 installed and file is accessible through it, i have tried this but i couldn't make it work

but, i have worked on this before, but i was using PollinghttpBinding no NetTCP, and i have created another service contract to return the ClientAccessPolicy file

i have tried to do the same i do before with PollinghttpBinding but i can't write the right Configuration of the Service

My client refuse to use IIS, so could i use this way and what is the right configuration i should use with this service?

this is the configuration i use for my Service

<service behaviorConfiguration="serviceBehavior" name="MyService">               <endpoint address="net.tcp://localhost:4502/MyService/Service"       behaviorConfiguration="endpointBehavior" binding="netTcpBinding"         bindingConfiguration="netTcpServiceBinding" contract="IMyService">                   <identity>                       <dns value="localhost"/>                   </identity>               </endpoint>               <endpoint address="net.tcp://localhost:7000/MyService/mex"     binding="mexTcpBinding" contract="IMetadataExchange"/>           </service> 

can anyone give help?

Answers & Comments...




How can I access content of a XamGrid Column

How can I access content of a XamGrid Column

I have created a XamGrid in a silverlight page in WCF. in which I have a column called "status" . It has three values which are : complete, start, ongoing. for these values I want to set add an image beside the text. How can I access XamGrid column contents from Code behind. I have used something like:

XamGrid1.column.[2].key 

but it is returning me the column name. and I want the value in that column.. Please someone help me do this?

Answers & Comments...




A WP7 page still running after navigating from

A WP7 page still running after navigating from

I'm implementing a game in Silverlight that has many timers. I stop all these timers each time I navigate from this page.

In some cases, when I navigate from the game page to menu page, the game is still running and I hear sounds of the game, although the timers are all stopped.

So is there a way to kill a WP7 page completely when navigating from it?

Thanks.

Answers & Comments...

Answer: 1

There is no way for you to "kill" a page. If you are doing a forward navigation, then the page will remain (and continue to run) in the background so that you may go back to it using the back button. If you are doing a back navigation, the page will be garbage-collected at some point (assuming you have unhooked all your events, disposed of any unmanaged resources, etc.)

by : Joel Sheahttp://stackoverflow.com/users/171622




Friday, December 21, 2012

Fwd: End-of-the-world SilverlightShow Content Recap (12/21/2012)



Sent from my iPhone

Begin forwarded message:

From: SilverlightShow <team@silverlightshow.net>
Date: December 21, 2012, 7:06:21 PM GMT+04:00
To: vinod8812@gmail.com
Subject: End-of-the-world SilverlightShow Content Recap (12/21/2012)
Reply-To: team@silverlightshow.net

SilverlightShow Weekly Digest Newsletter
SilverlightShow Weekly Digest
End-of-the-world SilverlightShow Content Recap (12/21/2012):

Read all new SilverlightShow content via Follow us on twitter Become a SilverlightShow fan on Facebook Join SilverlightShow Group on LinkedIn


Recording of Recent Webinar with Michael Crump - 'An Overview of the New Windows Phone 8 SDK'

This Tuesday (December 18th, 2012), SilverlightShow had the honor to host another great webinar by Michael Crump - An Overview of the New Windows Phone 8 SDK. Those of you who didn't make it to the live session can now watch the recorded presentation online:

Our next webinarDeeper Dive into the Windows Phone 8 SDK - is scheduled for January 15th. This session will be a deeper dive into the Windows Phone 8 SDK and will dive right into Near Field Communication (NFC), Native Code (C++), In-App Store purchases and Wallet transactions.

Learn more on this webinar | Register | See all upcoming and past SilverlightShow Webinars!




New Windows 8 Article with Tips for Passing MS Certification Exam 70-484

If you have plans to take Exam 70-484: Essentials of Developing Windows Store Apps, then you should check out this new article by Samidip Basu who recently took that test:

Another source that could be of help when preparing for the exam is our Xmas Bundle of 6 Ebooks on Windows 8. Get it here »



Last Chance to Join Two of Our Expiring Challenges

December 24th is the last day on which you can complete two of our recent challenges in the challenge portal Deed:

In the second challenge, you have a real chance to win a LEADTOOLS Document Imaging Developer Toolkit ($2,495 value!), so make sure to join it now!



40+ Fresh New Stories by Valued Bloggers and Community Sites

Top 5:

All other news we published:

Monday (December 17th, 2012)

Tuesday (December 18th, 2012)

Wednesday (December 19th, 2012)

Thursday (December 20th, 2012)

Friday (December 21st, 2012)

Happy Holidays and a most prosperous New Year from the whole SilverlightShow team!


Copyright 2012 All Rights Reserved SilverlightShow.net

Forward email

This email was sent to vinod8812@gmail.com by team@silverlightshow.net |  
Instant removal with SafeUnsubscribe| Privacy Policy.

SilverlightShow | 49 Balgaria Blvd, Business center floor 3 | Sofia | 1618 | Bulgaria