I am brand new to C# and UWP's and also pretty much Visual Studio, and I have now spent hours scouring the web trying to figure out how to get a button to open Command Prompt. The ultimate goal is to use it to execute a separate bit of Python code I've written, but baby steps. The reason I am not pursuing direct execution of the Python script (which I'm just assuming is possible) is because it has some output I would like to pass back to my UWP. I understand I may be going about this all wrong, but I don't know what I don't know so I'm just doing the best I can.
So, after hours of trying, I'm starting to wonder if using the latest version of Visual Studio (2017 downloaded a few days ago) is my actual problem. All of the solutions I keep finding in forums don't seem to work and it has me wondering if there are some namespaces or assemblies or libraries or whatever (shows you how much I know) that have been removed. I am consistently seeing "Process.Start..." but Process does not exist even when I try to add the various references the great internet keeps telling me to create. That's where I'm getting suspicious. When I go to the Reference Manager, under Assemblies->Extensions there is no "System" that I'm being told to add. But at the same time, I see Visual Studio already added "using System;" to the top of my code (header? forgive me).
So, I am in an endless loop of searching the web and typing BS into Visual Studio. Please help me. I'm going crazy. I will include the extremely limited code I have for your amusement (it's 95% Visual Studio generated).
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace Jarvis_UWP__C_Sharp_
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private async void Fetch_Click(object sender, RoutedEventArgs e)
{
ContentDialog TestDialog = new ContentDialog
{
Title = "Test",
Content = "Popup",
CloseButtonText = "Ok"
};
await TestDialog.ShowAsync();
Process.Start(....);
}
}
}