示例#1
0
        private async void RecentFileMenuItem_Click(object sender, RoutedEventArgs e)
        {
            bool canceled = AskToSaveCurrentFile();

            if (canceled)
            {
                return;
            }

            var menuItem = (MenuItem)sender;
            var mruItem  = menuItem.DataContext as MruItem;

            if (mruItem == null)
            {
                _mruManager.Clear();
            }
            else
            {
                if (mruItem.PackageType == PackageType.LocalPackage)
                {
                    await OpenLocalPackage(mruItem.Path);
                }
                else
                {
                    await DownloadAndOpenDataServicePackage(mruItem);
                }
            }
        }
        private async void RecentFileMenuItem_Click(object sender, RoutedEventArgs e)
        {
            var canceled = AskToSaveCurrentFile();

            if (canceled)
            {
                return;
            }

            DiagnosticsClient.TrackEvent("MainWindow_RecentFileMenuItemClick");

            var menuItem = (MenuItem)sender;

            if (menuItem.DataContext is MruItem mruItem)
            {
                if (mruItem.PackageType == PackageType.LocalPackage)
                {
                    await OpenLocalPackage(mruItem.Path);
                }
                else
                {
                    await DownloadAndOpenDataServicePackage(mruItem);
                }
            }
            else
            {
                _mruManager.Clear();
            }
        }