我正在Xamarin Studio上用C#制作一个简单的DOS操作系统。关键是我已经编写了一些程序来执行我在Visual Studio中无法在Xamarin上执行的任务。

尽我所能解释的困难:我有一个名为OSBootup.cs的类,我希望该类运行,然后在我的项目中启动另一个类。有什么办法吗?如果没有,我还能做另一种方法吗?

我的代码:(OSBootup.cs)

using System;
using System.IO;
using System.Threading;

namespace OperatingSystemCore
{
    public static class OSBootup
    {
        public static void Main (String[] args)
        {
            bool isStarting;

            Start:

            isStarting = true;

            Console.Write ("Starting SyteraOS ");

            Thread.Sleep (1000);
            Console.Write (". ");

            Thread.Sleep (1000);
            Console.Write (". ");

            Thread.Sleep (1000);
            Console.Write (". ");

            Thread.Sleep (1000);
            Console.Clear ();
            Console.Write ("Starting SyteraOS ");

            Thread.Sleep (1000);
            Console.Write (". ");

            Thread.Sleep (1000);
            Console.Write (". ");

            Thread.Sleep (1000);
            Console.Write (". ");

            Thread.Sleep (4500);
            Console.Clear ();

            Console.WriteLine ("Press Any Key To Start SyteraOS ...");
            Console.ReadKey ();

            End:

            DOSConsole DConsole = new DOSConsole ();

            isStarting = false;
        }
    }
}


并且以防万一您需要查看我的另一个文件(DOSConsole.cs):

using System;

namespace OperatingSystemCore
{
    public class DOSConsole
    {
        public void Start ()
        {
            Console.WriteLine ("Give us a name.");
            Console.WriteLine ("");
            Console.Write ("Name: ");
            string Name = Console.ReadLine ();

            Console.Clear ();
            Console.Write ("User->" + Name);
        }

        public void Update ()
        {

        }

        public void Commands ()
        {

        }
    }
}

最佳答案

您有DOSConsole DConsole = new DOSConsole ();,但您缺少DConsole.Start();.

(答案是:不安)

07-24 14:10