private async void DeleteElement(object x) { ConfirmWindow.ConfirmWindow t = new ConfirmWindow.ConfirmWindow(); t.DataContext = new ConfirmWindow.ConfirmWindowViewModel(); t.ShowDialog(); t.Focus(); if ((t.DataContext as ConfirmWindow.ConfirmWindowViewModel).Confirm) { if (x is Project) { var p = x as Project; await Communication.Instance.RemoveProject(new RemProjectDTO { ProjectId = p.Id }); } else { Step stepToRem = x as Step; var pid = (from a in projects where a.Steps.Contains(stepToRem) select a).FirstOrDefault(); if (pid != null) { await Communication.Instance.RemoveStep(new RemStepDTO { ProjectId = pid.Id, StepId = stepToRem.Id }); } } ReloadProjects(); } }
private void RemoveUserAccount(object x) { ConfirmWindow.ConfirmWindow t = new ConfirmWindow.ConfirmWindow(); t.DataContext = new ConfirmWindow.ConfirmWindowViewModel(); t.ShowDialog(); t.Focus(); if ((t.DataContext as ConfirmWindow.ConfirmWindowViewModel).Confirm) { var e = Communication.Instance.RemoveUserAsync(); LoginWindow w = new LoginWindow(); w.Show(); (x as AppWindow).Close(); } }