Posts
Tkinter's tkMessageBox
tkMessageBox.showinfo(“showinfo demo”, “Info”) tkMessageBox.showwarning(“showwarning demo”, “Warning”) tkMessageBox.showerror(“showerror demo”, “Error”)
print “askquestion’s dialogresult: %s” % tkMessageBox.askquestion(“askquestion demo”, “Sure?!”) print “askokcancel’s dialogresult: %s” % tkMessageBox.askokcancel(“askokcancel demo”, “OK?! CANCEL?!”, default = “ok”) print “askyesno’s dialogresult: %s” % tkMessageBox.askyesno(“askyesno demo”, “Yes?! No?!”, default = “no”) print “askretrycancel’s dialogresult: %s” % tkMessageBox.askretrycancel(“askretrycancel demo”, “Retry?! Cancel?!”, default = “cancel”)
read morePosts
Use ResourceDictionary to do multi-language in WPF
private void ApplyMultiLanguageResource() { ApplyMultiLanguageResource(CultureInfo.CurrentCulture); } private void ApplyMultiLanguageResource(CultureInfo cultureInfo) { var cultureName = cultureInfo.Name; var resourceFile = string.Empty; try { resourceFile = @"StringResources." + cultureName + ".xaml "; } catch (Exception) { } if (string.IsNullOrEmpty(resourceFile)) resourceFile = @"StringResources.xaml"; var rd = Application.LoadComponent(new Uri(resourceFile, UriKind.Relative)) as ResourceDictionary; var existsRD = this.Resources.MergedDictionaries.Where(item => item.Source.OriginalString.Equals(resourceFile, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); if (existsRD != null) this.Resources.MergedDictionaries.Remove(existsRD); this.Resources.MergedDictionaries.Add(rd); } }</pre></div>
read morePosts
Use Windows Error Reporting(WER) to collect user-mode dumps
namespace ConsoleApplication46 { class Program { static void Main(string[] args) { var x = 1; var y = x - 1; var result = x / y; } } }
read morePosts
VC.NET Natived Event
#include “stdafx.h”
class TestObj { public: __event void Executed();
protected: void OnExecuted() { printf(“Executed “); }
public: void Execute() { __raise Executed(); }
void BindingEvent(){ __hook(&TestObj::Executed,this,&TestObj::OnExecuted); } void UnBindingEvent(){ __unhook(&TestObj::Executed,this,&TestObj::OnExecuted); } };
int _tmain(int argc, _TCHAR* argv[]) { TestObj obj; obj.BindingEvent(); obj.Execute (); return 0; }
read more