Пример #1
0
        private void Tile_Click(object sender, RoutedEventArgs e)
        {
            Tile     tile = (Tile)sender;
            WorkItem item = (WorkItem)tile.Tag;

            if (WindowList.ContainsKey(item))
            {
                WindowList[item].Close += frame_Close;
                ContentControl.Content  = WindowList[item];
                return;
            }
            WorkFrame frame = new WorkFrame();

            frame.MainTitle = item.Name;
            WorkPage content = item.GetWorkPage();

            WindowList.Add(item, frame);
            MenuItem menu = new MenuItem();

            menu.Tag    = frame;
            menu.Click += Menu_Click;
            menu.SetBinding(MenuItem.HeaderProperty, new Binding {
                Source = frame, Mode = BindingMode.OneWay, Path = new PropertyPath("Content.Title")
            });
            WindowMenu.Items.Add(menu);
            frame.Close += frame_Close;
            frame.Close += (s, ee) =>
            {
                WindowList.Remove(item);
                WindowMenu.Items.Remove(menu);
                ContentControl.Content = StartMenu;
            };
            ContentControl.Content = frame;
            frame.NavigationService.NavigateTo(content);
        }
Пример #2
0
 protected virtual void OnNavigatedFrom(WorkPage page)
 {
     if (NavigatedFrom != null)
     {
         NavigatedFrom(this, page);
     }
 }
Пример #3
0
 protected virtual void OnNavigatedTo(WorkPage page)
 {
     if (NavigatedTo != null)
     {
         NavigatedTo(page, this);
     }
 }
Пример #4
0
 public void NavigateTo(WorkPage page)
 {
     WorkPage old = Frame.Content;
     Frame.Content = page;
     if (old != null)
     {
         History.Push(old);
         old.BaseNavigateFrom(page);                
     }
     if (page != null)
         page.BaseNavigateTo(old);
     if (Navigated != null)
         Navigated(old, page);
 }
Пример #5
0
 internal void BaseNavigateFrom(WorkPage page)
 {
     OnNavigatedFrom(page);
 }
Пример #6
0
 internal void BaseNavigateTo(WorkPage page)
 {
     OnNavigatedTo(page);
 }
Пример #7
0
 protected virtual void OnNavigatedFrom(WorkPage page)
 {
     if (NavigatedFrom != null)
         NavigatedFrom(this, page);
 }
Пример #8
0
 protected virtual void OnNavigatedTo(WorkPage page)
 {
     if (NavigatedTo != null)
         NavigatedTo(page, this);
 }
Пример #9
0
 internal void BaseNavigateFrom(WorkPage page)
 {
     OnNavigatedFrom(page);
 }
Пример #10
0
 internal void BaseNavigateTo(WorkPage page)
 {
     OnNavigatedTo(page);
 }