public void ContinueAsync(IObjectVM sender) { BusyToken token; _tokens.TryGetValue(sender, out token); token.ContinueAsync(); }
public void EndAsync(IObjectVM sender) { BusyToken token; _tokens.TryGetValue(sender, out token); if (token != null) { token.Done(); } }
/// <summary> Initializes a new instance of the <see cref="UIPropertiesRoot" /> class. /// </summary> /// <param name="owner">The owner.</param> public UIPropertiesRoot(IObjectVM owner) : base(owner) { Fields.AddLazy("Button", new Lazy <Button>(() => new Button(owner))); Fields.AddLazy("TreeViewItem", new Lazy <TreeViewItem>(() => new TreeViewItem(owner))); Fields.AddLazy("MenuItem", new Lazy <MenuItem>(() => new MenuItem(owner))); Fields.AddLazy("Selector", new Lazy <Selector>(() => new Selector(owner))); Fields.AddLazy("Item", new Lazy <ItemContainer>(() => new ItemContainer(owner))); Fields.AddLazy("ComboBox", new Lazy <ComboBox>(() => new ComboBox(owner))); _EventConnector = new Lazy <UIEventConnector>(() => new UIEventConnector(owner)); _Events = new Lazy <UIEvents>(() => new UIEvents(owner)); _InputGestures = new Lazy <InputGestureCollection>(() => new InputGestureCollection()); }
public void Navigate(IObjectVM source) { if (source == null) { UIElement.Navigate(null); } else { var viewType = ViewResolver.Default.Resolve(source.GetType()); var view = (FrameworkElement)Activator.CreateInstance(viewType); view.DataContext = source; UIElement.Navigate(view); } }
/// <summary> Creates a busy context /// </summary> /// <param name="sender">The sender.</param> /// <returns>BusyToken</returns> /// <example><code>using (BusyManager.Instance.Context(this)) { ... } </code></example> public BusyToken Context(IObjectVM sender) { BusyToken token; _tokens.TryGetValue(sender, out token); if (token == null) { token = new BusyToken(sender); _tokens.Add(sender, token); token.Finished += (s, e) => _tokens.Remove(((BusyToken)s).Sender); token.Start(); } else { token.ContinuedAsync(); } return(token); }
void IDisposable.Dispose() { if (_suppressDispose) { _suppressDispose = false; return; } if (_isDisposed) { return; } _isDisposed = true; _sender.RequestUserFeedback(new BusyUserFeedbackEventArgs(false)); if (Finished != null) { Finished(this, EventArgs.Empty); } _sender = null; }
public DelayedDispatcherTask(IObjectVM vm, TimeSpan delay, Action action) { _delay = delay; _action = action; _vmRef = vm == null?null:new WeakReference(vm); _dispatcher = ApplicationVM.Current.Dispatcher; var ts = new ThreadStart(Run); _thread = new Thread(ts) { IsBackground = true, Name = "BeginInvokeDelay#" + (++s_BeginInvokeDelayCount) }; //m_AsyncWaitHandle=new ManualResetEvent(false); _thread.Start(); }
internal BusyToken(IObjectVM sender) { _sender = sender; }
/// <summary> Initializes a new instance of the <see cref="UIPropertiesBase" /> class. /// </summary> /// <param name="owner">The owner.</param> public UIPropertiesBase(IObjectVM owner) { _Owner = owner; _Fields = new BackingFieldsStore(this, OnPropertyChanged); }
public object InputRequired(IObjectVM sender, string inputField) { sender.RequestUserFeedback(new MessageFeedbackEventArgs("Input required: " + inputField, "Error", MessageBoxButton.OK, MessageBoxImage.Error)); return(null); }
public void Exception(IObjectVM sender, Exception exception) { sender.RequestUserFeedback(new ExceptionFeedbackEventArgs(exception)); }
/// <summary> Called when this view model has been activated. /// </summary> /// <param name="refferer">The refferer.</param> protected virtual void OnActivated(IObjectVM refferer) { }
/// <summary> Notifies this view model has been activated /// </summary> /// <param name="refferer">The refferer.</param> public void NotifyActivated(IObjectVM refferer) { OnActivated(refferer); }