Example #1
0
        private void Window_SourceInitialized(object sender, EventArgs e)
        {
            Top    = 0;
            helper = new WindowInteropHelper(this);
            Handle = helper.Handle;
            HwndSource.FromHwnd(helper.Handle).AddHook(new HwndSourceHook(WndProc));

            if (Settings.Instance.EnableDesktop && Icons == null)
            {
                grid.Children.Add(Icons = new DesktopIcons());

                string defaultDesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string userDesktopPath    = Settings.Instance.DesktopDirectory;

                // first run won't have desktop directory set
                if (string.IsNullOrWhiteSpace(userDesktopPath))
                {
                    Settings.Instance.DesktopDirectory = defaultDesktopPath;
                    userDesktopPath = defaultDesktopPath;
                }

                if (Directory.Exists(userDesktopPath))
                {
                    NavigationManager.NavigateTo(userDesktopPath);
                }
                else if (Directory.Exists(defaultDesktopPath))
                {
                    NavigationManager.NavigateTo(defaultDesktopPath);
                }

                if (Settings.Instance.EnableDynamicDesktop)
                {
                    TryAndEat(() =>
                    {
                        DesktopNavigationToolbar nav = new DesktopNavigationToolbar()
                        {
                            Owner = this, NavigationManager = NavigationManager
                        };
                        nav.Show();
                    });
                }
            }

            SetupPostInit();
        }
Example #2
0
 public void Navigate(string newLocation)
 {
     navigationManager.NavigateTo(newLocation);
 }