Async Await in Windows apps for UX

Friday, July 17, 2015

Asynchronous programing can help us to improve better User Experience Like on next scenario: You got list of items , now every selection on any list items made some IO operation or complex validation on server or whatever. You can easily solve it out with async operation. View: <ListBox IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Data}" SelectedValue="{Binding MyProperty, UpdateSourceTrigger=PropertyChanged}" /> ViewModel: public List<string> Data { get { return new List<string>() { "aa", "bb", "cc", "dd", "ee" }; } } public object...
אין תגובות

Out Of Memory Exception Simulation and Profiling

Wednesday, January 21, 2015

,If that was happened to you, mining you are in deep problem ?But, my point is different. what if it came from no were and not a clue why The biggest problem is that sometime when the exception is deep, you just cannot debug your .app anymore So maybe if we could get information a second before this exception , something like => " hey "...dude watch out ! its about memory ending :That leading to next idea public static void ProccesProfiler() { Timer timer = new Timer(); ...
אין תגובות

Text Input validation via Behavior with regular expression

Wednesday, December 10, 2014

,If you need a validation to a textbox input values Use behavior like the next one , and don't mess your code with codeBehaind sections, also it is !the best for reuse of code The following demo-code is for windows standard file name rules, you can easily change the .Regular expression as you need public class FileNameValidation : Behavior<TextBox> { private string regex = @"^+$"; protected override void OnAttached() { ...
אין תגובות

Prevent unexpected System Shutdown During runtime

Friday, October 31, 2014

,Running application could be critical sometimes .For example while writing Data to server of course we can by configuring OS from Win7 and up to provide information on running apps ,for most of times when we are try to shutdown or sleep the system Yet we have special event in Application class we can registered on, and getting noticed when :OS get into logoff or shutdown public partial class App : Application { public App() { SessionEnding...
אין תגובות

Observable Dictionary – implementation

Tuesday, September 16, 2014

,This is not a full implementation but only a starter for dummies ,still it is very nice to look on it and try it by yourself lets face it, Dictionary is one of the complex collections, and to be Observable required good .knowledge in collections , and INotifyCollectionChanged Interface .To be fully implemented we need to extend few parts which I discussed later Back to business , in earlier post I have been demonstrate the needs of ObservableDictionary. LINK But even without this scenario it is simple requirement, I am also wondering why there isn’t built .it in dot net framework :So lets build a simple one What...

C# Serialization Guide Part 11 – Json.Net

,Probably the most popular way to using Json format to/from C# is by Json.Net library This is an great 3party package with great demos and open-source solution, you can download :the full lib from here http://james.newtonking.com/json:   or from codeplex https://json.codeplex.com/ .or directly from visual studio Nuget console Anyway, for read/ write to/from Json format I where show the DataContractJsonSerializer usage :in my former json serialization post http://blogs.microsoft.co.il/uriel99/2014/04/27/c-serialization-guide-part-6-json/ .but using Json.Net Library is very good alternative After you download the files all you need is the proper dll from binary folder for example ,the .Net4.5 version. And add it as reference to you project You can use the service either on local file...
אין תגובות

Reflection Part 2

Friday, August 22, 2014

בפוסט הקודם פגשנו את נושא הReflection ברמת מבוא, עכשיו נבדוק דוגמא שימושית. נצייר את התרחיש הבא: יש לנו שצי ספריות, אחת מכילה את הקלאס Person ונקראת ReflectionReferenceSource, namespace ReflectionReferenceSource { public class Person { public Person() { Name = "Moshe"; public string Name { get; set; } public void activateFunction() { ...
תגובה אחת

Reflection Part 1

Monday, August 18, 2014

למרות שלאחרונה כתבתי אך ורק באנגלית (לטובת אחינו שמעבר לים התיכון) הפעם אני כותב בעקבות הרצאה שהעברתי לסטודנטים בתחום, ואני משאיר את זה כפוסט רפרנס למי שמנסה להיכנס לעניינים(מן הסתם בשלבי לימוד כאלה או אחרים) ונקל עליו עוד קצת ונכתוב בשפה המקומית. מה זה Reflection ? אז דוט נט כשיטה זה אומר סביבה וירטואלית שמקבלת קוד בשפה עילית, מתרגמת אותו לשפת ביניים, מטפלת בדברים כמו ניהול זיכרון, טיפול בחריגות, תקשורת מול מע' ההפעלה המקומית ועוד. היחידה המרכזית בסיפור הזה נקראת CLR שהוא אחראי על ייצור קוד הביניים שנקרא IL בהטייה כזאת או אחרת, שזה Intermediate language מאחר שכך תוצאה של קוד מקומפל ל...
תגובה אחת

WPF Set Focus On dialog Owner when dialog get closed

Monday, July 28, 2014

This situation might be a complex one ,  and can be leveraged itself within a few conditional .levels , in a custom PopUp which will be a probably kind of Window , in pyramid of complex UI, like in N tiers UI levels , WPF Distributed Application – like Prism . using 3-party controls ?And what do I mean Showing Dialog from UI , probably need to close when user click on any dialog's button than the .UI who raised it , get the focus back ,In the samples at the Post starting , we may get some problems :To be specific .I have an Custom-PopUp which is simple Window ,In...
תגובה אחת