Обратитесь к OAuth2 «неявному потоку», где сервер авторизации напрямую передает маркер доступа браузеру в хэш-фрагменте URL. Хеш-фрагменты никогда не отправляются на внутренний сервер. Однако «неявный поток» не так защищен, как поток «кода авторизации».
It turned out that even if i was raising an event before removing them, they would get removed instantly anyway. So as i was using it as an observable stack, i worked around this by leaving the removed element in the collection and removing it later. like this:
public class ObservableStack<T> : ObservableCollection<T>
{
private T collapsed;
public event EventHandler BeforePop;
public T Peek() {
if (collapsed != null) {
Remove(collapsed);
collapsed = default(T);
}
return this.FirstOrDefault();
}
public T Pop() {
if (collapsed != null) { Remove(collapsed); }
T result = (collapsed = this.FirstOrDefault());
if (BeforePop != null && result != null) BeforePop(this, new EventArgs());
return result;
}
public void Push(T item) {
if (collapsed != null) {
Remove(collapsed);
collapsed = default(T);
}
Insert(0, item);
}
}
Might not be the best solution, but it does the job (at least if i only use it as a stack).
I don't have access to a code window at the moment so this is a little off the cuff, but could you extend the FrameworkElement with an Unloading event, then initiate that from CollectionChanged in an ObservableCollection. It means using a custom ObservableColleciton and custom FrameworkElement class but it could offer you what you need?