private void AltoShaamButton_Click(object sender, RoutedEventArgs e)
        {
            NavigationWindow AltoShaamSite = new NavigationWindow();

            AltoShaamSite.Source = new Uri("https://www.alto-shaam.com/en", UriKind.Absolute);
            AltoShaamSite.ShowDialog();
        }
        private void mnuRunWizard_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                JobParameters    parms  = new JobParameters();
                NavigationWindow wizard = new NavigationWindow();

                Page startPage = new Wizard.WizardStartPage(ref parms);
                startPage.ShowsNavigationUI = false;
                wizard.Content = startPage;
                wizard.Width   = startPage.Width;
                wizard.ShowDialog();

                if (parms.isValid)
                {
                    this.jobList.Add(parms);
                    grdJobList.Items.Refresh();
                }


                Globals.patientCtx = null;
                Globals.eclipseAPI.ClosePatient();
                wizard = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void ExtractClicked(object sender, RoutedEventArgs e)
        {
            DirectoryInfo root = new DirectoryInfo(Path.Text);

            root.Create(); // ensure that the folder exists
            List <ProgressTask> tasks = new List <ProgressTask>();

            if (TicketCheckbox.IsChecked == true)
            {
                DirectoryInfo ticketDir    = HACGUIKeyset.GetTicketsDirectory(Preferences.Current.DefaultConsoleName); // TODO: load console name from continuous location
                List <string> foundTickets = new List <string>();
                foreach (Nca nca in SelectedNcas.Select(n => n.Nca))
                {
                    if (nca.Header.HasRightsId)
                    {
                        string   rightsId          = nca.Header.RightsId.ToHexString();
                        string   ticketFileName    = rightsId + ".tik";
                        FileInfo sourceTikFileInfo = ticketDir.GetFile(ticketFileName);
                        if (sourceTikFileInfo.Exists)
                        {
                            FileInfo destinationTikFileInfo = root.GetFile(ticketFileName);
                            if (!foundTickets.Contains(rightsId))
                            {
                                foundTickets.Add(rightsId);
                                destinationTikFileInfo.CreateAndClose();
                                LocalFile sourceTikFile      = new LocalFile(sourceTikFileInfo.FullName, OpenMode.Read);
                                LocalFile destinationTikFile = new LocalFile(destinationTikFileInfo.FullName, OpenMode.Write);
                                destinationTikFile.SetSize(sourceTikFile.GetSize());
                                tasks.Add(new CopyTask($"Copying {ticketFileName}...", new FileStorage(sourceTikFile), new FileStorage(destinationTikFile)));
                            }
                        }
                    }
                }
            }

            foreach (SwitchFsNca nca in SelectedNcas)
            {
                FileInfo destinationNcaFileInfo = root.GetFile(nca.Filename);
                destinationNcaFileInfo.CreateAndClose();
                LocalFile destinationNcaFile = new LocalFile(destinationNcaFileInfo.FullName, OpenMode.Write);
                IStorage  source             = nca.Nca.BaseStorage;
                tasks.Add(new RunTask($"Allocating space for {nca.Filename}...", new Task(() =>
                {
                    destinationNcaFile.SetSize(source.GetSize());
                })));
                tasks.Add(new CopyTask($"Copying {nca.Filename}...", source, new FileStorage(destinationNcaFile)));
            }
            ProgressView     view   = new ProgressView(tasks);
            NavigationWindow window = new NavigationWindow
            {
                ShowsNavigationUI = false // get rid of the t r a s h
            };

            window.Navigate(view);

            TaskManagerPage.Current.Queue.Submit(tasks);

            window.Owner = Window.GetWindow(this);
            window.ShowDialog();
        }
        private void ExtractClicked(object sender, RoutedEventArgs e)
        {
            MountType     mountType   = (MountType)ComboBox.SelectedItem;
            NcaFormatType sectionType = NcaFormatType.Romfs;

            switch (mountType)
            {
            case MountType.Exefs:
                sectionType = NcaFormatType.Pfs0;
                break;

            case MountType.Romfs:
                sectionType = NcaFormatType.Romfs;
                break;
            }

            IEnumerable <Tuple <SwitchFsNca, int> > list = Indexed[sectionType];
            string path = Path.Text;

            TaskManagerPage.Current.Queue.Submit(new RunTask("Opening filesystems to extract...", new Task(() =>
            {
                List <IFileSystem> filesystems = new List <IFileSystem>();
                foreach (Tuple <SwitchFsNca, int> t in list)
                {
                    SwitchFsNca nca     = t.Item1;
                    NcaFsHeader section = t.Item1.Nca.Header.GetFsHeader(t.Item2);
                    int index           = t.Item2;

                    filesystems.Add(nca.OpenFileSystem(index, IntegrityCheckLevel.ErrorOnInvalid));
                }
                filesystems.Reverse();

                LayeredFileSystem lfs      = new LayeredFileSystem(filesystems);
                ExtractFileSystemTask task = new ExtractFileSystemTask($"Extracting {sectionType}...", lfs, path);

                Dispatcher.InvokeAsync(() =>
                {
                    ProgressView view = new ProgressView(new List <ProgressTask>()
                    {
                        task
                    });
                    NavigationWindow window = new NavigationWindow
                    {
                        ShowsNavigationUI = false // get rid of the t r a s h
                    };
                    window.Navigate(view);

                    TaskManagerPage.Current.Queue.Submit(task);

                    window.Owner = Window.GetWindow(this);
                    window.ShowDialog();
                });
            })));
        }
Exemple #5
0
        private void HelpAbout_Click(object sender, RoutedEventArgs e)
        {
            NavigationWindow navWnd = new NavigationWindow();

            navWnd.Content = new Autoprofile.Help_Window();
            navWnd.Width   = 500;
            navWnd.Height  = 350;
            navWnd.Owner   = this;
            navWnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            navWnd.ShowDialog();
        }
Exemple #6
0
 /// <summary>
 /// 打开页面
 /// </summary>
 public void ShowPg()
 {
     NavigaionWin.Content = ChildWindow;
     if (IsLockedParentWin == true)
     {
         NavigaionWin.ShowDialog();
     }
     else
     {
         NavigaionWin.Show();
     }
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            NavigationWindow nw = new NavigationWindow();

            nw.ShowInTaskbar = false;
            //nw.ShowsNavigationUI = false;
            nw.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            var pd = new PreDesignView();

            nw.Width   = pd.Width;
            nw.Height  = pd.Height;
            nw.Content = pd;
            nw.ShowDialog();
        }
Exemple #8
0
        private void RepackClicked(object sender, RoutedEventArgs e)
        {
            FileInfo info = new FileInfo(Path.Text);

            info.Directory.Create(); // ensure that the folder exists
            Pfs0Builder  builder = new Pfs0Builder();
            NspPackTask  logger  = new NspPackTask(builder, info);
            ProgressView view    = new ProgressView(new List <ProgressTask> {
                logger
            });

            if (TicketCheckbox.IsChecked == true)
            {
                DirectoryInfo ticketDir    = HACGUIKeyset.GetTicketsDirectory(Preferences.Current.DefaultConsoleName); // TODO: load console name from continuous location
                List <string> foundTickets = new List <string>();
                foreach (Nca nca in SelectedNcas)
                {
                    if (nca.HasRightsId)
                    {
                        string   rightsId          = BitConverter.ToString(nca.Header.RightsId).Replace("-", "").ToLower();
                        string   ticketFileName    = rightsId + ".tik";
                        FileInfo sourceTikFileInfo = ticketDir.GetFile(ticketFileName);
                        if (sourceTikFileInfo.Exists && !foundTickets.Contains(rightsId))
                        {
                            foundTickets.Add(rightsId);
                            LocalFile tikFile = new LocalFile(sourceTikFileInfo.FullName, OpenMode.Read);
                            builder.AddFile(ticketFileName, new FileStorage(tikFile).AsStream());
                        }
                    }
                }
            }

            foreach (Nca nca in SelectedNcas)
            {
                builder.AddFile(nca.Filename, nca.GetStorage().AsStream());
            }


            NavigationWindow window = new NavigationWindow
            {
                ShowsNavigationUI = false // get rid of the t r a s h
            };

            window.Navigate(view);
            TaskManagerPage.Current.Queue.Submit(logger);
            window.Owner = Window.GetWindow(this);
            window.ShowDialog();
        }
        /// <summary>
        /// 数据库按钮 点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OpenData_Click(object sender, RoutedEventArgs e)
        {
            if (Proj_path == null)
            {
                MessageBox.Show("请先打开工程!");
                return;
            }
            NavigationWindow window = new NavigationWindow
            {
                Source = new Uri("BoltDataShowPage.xaml", UriKind.Relative),
                Title  = "数据库",
                Owner  = this,
            };

            window.ShowDialog();
        }
        private void ViewButtonClicked(object sender, RoutedEventArgs e)
        {
            List <ProgressTask> tasks = new List <ProgressTask>();

            foreach (TaskElement element in List.SelectedItems)
            {
                tasks.Add(element.Task);
            }

            ProgressView     view   = new ProgressView(tasks);
            NavigationWindow window = new NavigationWindow
            {
                ShowsNavigationUI = false, // get rid of the t r a s h
                Owner             = Window.GetWindow(this)
            };

            window.Navigate(view);
            window.ShowDialog();
        }
Exemple #11
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            NavigationService nav = NavigationService.GetNavigationService((Button)sender);

            if (nav != null)
            {
                nav.Navigate(new Uri("CodingEditor.xaml", UriKind.RelativeOrAbsolute));
            }

            NavigationWindow window = new NavigationWindow();

            window.Source            = new Uri("Pages/Coding/CodingEditor.xaml", UriKind.Relative);
            window.Width             = 550;
            window.Height            = 525;
            window.ShowsNavigationUI = false;
            window.Icon = null;
            window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            window.ShowDialog();
        }
Exemple #12
0
        private async Task <bool> CanConnectUsingOpenId(Connection connection)
        {
            try
            {
                using (var source = new CancellationTokenSource())
                {
                    var discoveryUrl = new Uri(new Uri(connection.Uri), "/" + OpenIdProviderMetadataNames.Discovery);
                    var config       = await OpenIdConnectConfigurationRetriever.GetAsync(discoveryUrl.ToString(), source.Token);

                    var result = false;
                    var closed = false;

                    var authEndpoint = config.AuthorizationEndpoint +
                                       "?scope=email%20profile" +
                                       "&response_type=code" +
                                       "&redirect_uri=http://localhost:" + connection.RedirectPort +
                                       "&client_id=" + WebUtility.UrlEncode(connection.ClientId);

                    await Runtime.InvokeAsync(() =>
                    {
                        var window = new NavigationWindow()
                        {
                            WindowStartupLocation = WindowStartupLocation.CenterOwner,
                            Owner             = Application.Current?.MainWindow,
                            Title             = "Authenticate",
                            ShowsNavigationUI = false,
                            Source            = new Uri(authEndpoint),
                            Width             = 500,
                            Height            = 400
                        };

                        var listener = new HttpListener();
                        listener.Prefixes.Add($"http://*:{ connection.RedirectPort }/");
                        listener.Start();

                        listener.BeginGetContext(x =>
                        {
                            if (!listener.IsListening || closed)
                            {
                                return;
                            }

                            var context = listener.EndGetContext(x);
                            var code    = context.Request.QueryString["code"];

                            Runtime.Invoke(() =>
                            {
                                result = !string.IsNullOrWhiteSpace(code);
                                window.Close();
                            });
                        }, null);

                        window.Closed += (s, e) =>
                        {
                            closed = true;
                            listener.Stop();
                        };

                        window.ShowDialog();
                    });

                    _log.DebugFormat("OpenID connection test {0}", result ? "passed" : "failed");
                    return(await Task.FromResult(result));
                }
            }
            catch (Exception ex)
            {
                _log.Error("OpenID connection test failed", ex);
                return(await Task.FromResult(false));
            }
        }