CosmosOS / Cosmos

Cosmos is an operating system "construction kit". Build your own OS using managed languages such as C#, VB.NET, and more!
https://www.goCosmos.org
BSD 3-Clause "New" or "Revised" License
2.93k stars 553 forks source link

GUI #496

Closed ghost closed 8 years ago

ghost commented 8 years ago

I want to make a GUI for my COSMOS project, I have made everything else. Now I want to make a GUI for it. I tried the instructions, but I cant figure out how to reference the Hardware project. Can I have the source code for it? (Or a better tutorial at least)

ghost commented 8 years ago

Try using the HAL project instead.

On Fri, Oct 28, 2016 at 10:11 PM, DjAlEx234 notifications@github.com wrote:

I want to make a GUI for my COSMOS project, I have made everything. Now I want to make a GUI for it. I tried the instructions, but I cant figure out how to reference the Hardware project.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CosmosOS/Cosmos/issues/496, or mute the thread https://github.com/notifications/unsubscribe-auth/ARf_UC42XvX29JMOhO_gQDiKBgz01h8hks5q4qs1gaJpZM4Kj_89 .

jp2masa commented 8 years ago

@MichaelTheShifter it's not the HAL project, it's the Hardware project created during the tutorial. @DjAlEx234 Right-click References in your main Cosmos project (the one without Boot in the name) and click Add Reference, go to Project References and select the Hardware project.

ghost commented 8 years ago

Thanks! I would never look there. I love cosmos and it's community, this helped me a lot.

ghost commented 8 years ago

Okay, so I tried it. It says from this code using Hardware; Hardware does not exist in this context. Can I have a finished project that works with it?

jp2masa commented 8 years ago

What namespace did you use in the DisplayDriver class?

ghost commented 8 years ago

CosmosKernel4 (the name of the project)

jp2masa commented 8 years ago

And the main project is CosmosKernel3?

ghost commented 8 years ago

no the main project is CosmosKernel4

jp2masa commented 8 years ago

And the project of the DisplayDriver?

ghost commented 8 years ago

Hardware

jp2masa commented 8 years ago

In the DisplayDriver class, what's the namespace?

ghost commented 8 years ago

shouldn't it be CosmosKernel4? or should it be Display?

jp2masa commented 8 years ago

If it's CosmosKernel4 you don't need any "using"

ghost commented 8 years ago

then what do you do?

jp2masa commented 8 years ago

Ignore the "using" part

ghost commented 8 years ago

k i'll try it

ghost commented 8 years ago

I`m confused, can I have a project that is finished?

jp2masa commented 8 years ago

Finished like what?

ghost commented 8 years ago

the gui part finished. but the default code in run

jp2masa commented 8 years ago

You did the part of initializing the DisplayDriver?

ghost commented 8 years ago

it showed an error

jp2masa commented 8 years ago

Whenever you get an error, please paste the output log.

ghost commented 8 years ago

ok

ghost commented 8 years ago

1>------ Build started: Project: Hardware, Configuration: Debug x86 ------ 1> Hardware -> C:\Users\ajcre\Desktop\CosmosKernel4\Hardware\bin\Debug\Hardware.dll 2>------ Build started: Project: CosmosKernel4, Configuration: Debug x86 ------ 2>C:\Users\ajcre\Desktop\CosmosKernel4\CosmosKernel4\Kernel.cs(14,13,14,20): error CS0103: The name 'display' does not exist in the current context 2>C:\Users\ajcre\Desktop\CosmosKernel4\CosmosKernel4\Kernel.cs(15,13,15,20): error CS0103: The name 'display' does not exist in the current context Build has been canceled.

jp2masa commented 8 years ago

You have something like: public class Kernel : Sys.Kernel {

Right after that write: DisplayDriver display;

ghost commented 8 years ago

?

ghost commented 8 years ago

want the code

jp2masa commented 8 years ago

In your Kernel.cs file

jp2masa commented 8 years ago

Paste Kernel.cs contents if you want me to help you better

ghost commented 8 years ago

ok: `using static System.Console; using Sys = Cosmos.System; using System.IO;

namespace CosmosKernel4 { public class Kernel : Sys.Kernel { protected override void BeforeRun() { var fs = new Sys.FileSystem.CosmosVFS(); Sys.FileSystem.VFS.VFSManager.RegisterVFS(fs); Clear(); display = new DisplayDriver(); display.init(); WriteLine("Zach OS booted correctly! Type help for help!"); }

    protected override void Run()
    {
        Main();
    }

    void Main()
    {
        CursorVisible = true;
        while (true)
        {
            Write("$: ");
            var a = ReadLine();
            if ((a == "help") || (a == "about") || (a == "cls") || (a == "restart") || (a == "off")||(a == "dir"))
            {
                var c_path = Directory.GetCurrentDirectory();
                if (a == "help")
                {
                    Help();
                }
                if (a == "about")
                {
                    About();
                }
                if (a == "cls")
                {
                    Clear();
                }
                if (a == "restart")
                {
                    Sys.Power.Reboot();
                }
                if (a == "off")
                {
                    AfterRun();
                }
                if (a == "dir")
                {
                    string akhdkuhksihaiuefhiauefhi = "In directory " + c_path;
                    WriteLine(akhdkuhksihaiuefhiauefhi);
                }
            }
            else
            {
                string b ="<" + a + ">" + " is not a command";
                WriteLine(b);
            }
        }
    }

    protected override void AfterRun()
    {
        base.AfterRun();
        Clear();
        CursorVisible = false;
        WriteLine("It is now safe to turn off your computer");
        while (true)// looooooooooooooooooooooooooooooooooooooop
        {
            ReadKey(true);
        }
    }

    void About()
    {
        Clear();
        WriteLine("About Zach OS");
        WriteLine("This is Open Source");
        WriteLine("Beta 0.1 Beta");
        WriteLine("Build 0199");
    }

    void Help()
    {
        Clear();
        WriteLine("Here is a list of commands:");
        WriteLine("about - Tells you about the OS");
        WriteLine("cls - Clears the screen");
        WriteLine("dir - Shows the file(s)/folder(s) in the directory");
        WriteLine("help - Gives you a list of commands");
        WriteLine("off - Turns off the OS");
        WriteLine("restart - Restarts the OS");
    }
}

}`

jp2masa commented 8 years ago

As I said: " You have something like: public class Kernel : Sys.Kernel {

Right after that write: DisplayDriver display; "

ghost commented 8 years ago

after the public class Kernel : Sys.Kernel { part? then change it to: public class Kernel : Sys.Kernel { DisplayDriver display;

jp2masa commented 8 years ago

Yes

ghost commented 8 years ago

k ill try it

ghost commented 8 years ago

thanks it works! I love the community for this.