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);
        }
Example #2
0
 protected virtual void OnNavigatedFrom(WorkPage page)
 {
     if (NavigatedFrom != null)
     {
         NavigatedFrom(this, page);
     }
 }
Example #3
0
 protected virtual void OnNavigatedTo(WorkPage page)
 {
     if (NavigatedTo != null)
     {
         NavigatedTo(page, this);
     }
 }
Example #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);
 }
Example #5
0
 internal void BaseNavigateFrom(WorkPage page)
 {
     OnNavigatedFrom(page);
 }
Example #6
0
 internal void BaseNavigateTo(WorkPage page)
 {
     OnNavigatedTo(page);
 }
Example #7
0
 protected virtual void OnNavigatedFrom(WorkPage page)
 {
     if (NavigatedFrom != null)
         NavigatedFrom(this, page);
 }
Example #8
0
 protected virtual void OnNavigatedTo(WorkPage page)
 {
     if (NavigatedTo != null)
         NavigatedTo(page, this);
 }
Example #9
0
 internal void BaseNavigateFrom(WorkPage page)
 {
     OnNavigatedFrom(page);
 }
Example #10
0
 internal void BaseNavigateTo(WorkPage page)
 {
     OnNavigatedTo(page);
 }