Skip to content

Instantly share code, notes, and snippets.

// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
loadPersistentState();
}
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
@renestein
renestein / IInitialize.cs
Created December 17, 2010 14:04
Rozhraní IInitialize
public interface IInitialize
{
void Init();
SynchronizationContext SynchContext
{
get;
set;
}
}
@renestein
renestein / ITranzientStateManager.cs
Created December 17, 2010 14:09
Rozhraní ITranzientStateManager.cs
public interface ITransientStateManager
{
object SaveState();
void LoadState(object obj);
}
@renestein
renestein / IActivatedDeactivated.cs
Created December 17, 2010 14:15
Rozhraní IActivated a IDeactovated
public interface IActivated
{
void Activate();
}
public interface IDeactivated
{
void Deactivate();
}
@renestein
renestein / PropertyNotificationBase.cs
Created December 17, 2010 14:21
Třída PropertyNotificationBase.cs
public class PropertyNotificationBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged = delegate{};
public PropertyNotificationBase()
{
SuppressPropertyChangedNotification = false;
}
public SynchronizationContext SynchContext
@renestein
renestein / UserName.cs
Created December 17, 2010 14:30
property UserName
public virtual string UserName
{
get
{
return m_userName;
}
set
{
@renestein
renestein / ViewModelBase.cs
Created December 17, 2010 14:49
Třída ViewModelBase.cs
public abstract class ViewModelBase : PropertyNotificationBase, ITransientStateManager, IInitialize, IActivated, IDeactivated
{
public ViewModelBase()
{
}
static ViewModelBase()
{
@renestein
renestein / PageTitle.cs
Created December 17, 2010 15:09
ViewModelBase - Page title
public ViewModelBase(string pageTitle) : this()
{
PageTitle = pageTitle;
}
public string PageTitle
{
get;
set;
}
@renestein
renestein / CanUseModel.cs
Created December 17, 2010 15:17
ViewModelBase - CanUseModel.cs
public bool CanUseModel
{
get
{
return !IsInvalidModel && IsAllInitDataLoaded();
}
}
@renestein
renestein / Init.cs
Created December 17, 2010 15:26
ViewModelBase-Init.cs
public void Init()
{
try
{
IsInvalidModel = true;
AppTitle = GlobalConstants.APP_MAIN_TITLE;
SuppressValidating = false;
IsInvalidModel = false;
DoInternalInit();
ThreadPool.QueueUserWorkItem(_ =>