示例#1
0
        private void App_Edit(object sender, RoutedEventArgs e)
        {
            MainViewModel model  = (MainViewModel)DataContext;
            EditWindow    window = new EditWindow(false);

            window.DataContext = new EditViewModel
            {
                Link = model.SelectedLink
            };
            window.ShowDialog();
            if (((EditViewModel)window.DataContext).Link != null)
            {
                ((MainViewModel)DataContext).GetUser();
            }
        }
示例#2
0
        private void App_Add(object sender, RoutedEventArgs e)
        {
            MainViewModel model  = (MainViewModel)DataContext;
            EditWindow    window = new EditWindow(true);

            window.DataContext = new EditViewModel
            {
                Link = new LinkUi
                {
                    UserId = model.UserId
                }
            };
            window.ShowDialog();
            if (((EditViewModel)window.DataContext).Link != null)
            {
                ((MainViewModel)DataContext).GetUser();
            }
        }