Exemple #1
0
        private void DistroElementHolder_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var distro = getSelectedDistro();

            if (distro != null)
            {
                ProcessOps.runDistro(distro.distroName);
            }
            refresh();
        }
Exemple #2
0
        private void MenuItem_Click_Remove(object sender, RoutedEventArgs e)
        {
            var distro = getSelectedDistro();

            if (distro == null)
            {
                return;
            }

            ProcessOps.unregisterDistro(distro.distroName);
            refresh();
        }
Exemple #3
0
        private void MenuItem_Click_Change_Wsl_Version(object sender, RoutedEventArgs e)
        {
            var distro = getSelectedDistro();

            if (distro == null)
            {
                return;
            }

            ProcessOps.changeDistroVersion(distro.distroName, ((distro.wslVersion) % 2) + 1);
            refresh();
        }
Exemple #4
0
        private void MenuItem_Click_Set_Default(object sender, RoutedEventArgs e)
        {
            var distro = getSelectedDistro();

            if (distro == null)
            {
                return;
            }

            ProcessOps.setDefaultDistro(distro.distroName);
            refresh();
        }
Exemple #5
0
        private void MainWindows_import(object sender, RoutedEventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.OverwritePrompt = false;
            saveFileDialog1.Filter          = "rootfs|*.tar.gz";
            saveFileDialog1.Title           = "Importing distro";
            saveFileDialog1.ShowDialog();

            string tartoinstall = saveFileDialog1.FileName;

            if (tartoinstall == "")
            {
                return;
            }

            var dialog = new CommonOpenFileDialog();

            dialog.IsFolderPicker = true;
            CommonFileDialogResult result = dialog.ShowDialog();

            if (dialog.FileName == "")
            {
                return;
            }
            string directorytoinstall = dialog.FileName;

            bool res = MessageBox.Show("We encourage to install WSL2", "Click NO if you want WSL1",
                                       MessageBoxButton.YesNo,
                                       MessageBoxImage.Question,
                                       MessageBoxResult.Yes) == MessageBoxResult.Yes;
            int version = 2;

            if (!res)
            {
                version = 1;
            }

            string input = Interaction.InputBox("Write the name you want to have for your distro",
                                                "Distro Name", "Default", -1, -1);


            if (input == "")
            {
                return;
            }
            ProcessOps.installDistro(input, tartoinstall, directorytoinstall, version);
            refresh();
        }
Exemple #6
0
        private void MenuItem_Click_Export(object sender, RoutedEventArgs e)
        {
            var distro = getSelectedDistro();

            if (distro == null)
            {
                return;
            }
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter = "rootfs|*.tar.gz";
            saveFileDialog1.Title  = "Exporting distro: " + distro.distroName;
            saveFileDialog1.ShowDialog();

            if (saveFileDialog1.FileName != "")
            {
                ProcessOps.exportDistro(distro.distroName, saveFileDialog1.FileName);
            }

            refresh();
        }