private AutomationElement GetWindow(string name)
        {
            AutomationElement element = AutomationElement.RootElement.FindFirst(TreeScope.Children,
                                                                                new AndCondition(
                                                                                    new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window)
                                                                                    , new PropertyCondition(AutomationElement.NameProperty, name)
                                                                                    , new PropertyCondition(AutomationElement.ProcessIdProperty, DesktopController.DesktopProcess.Id)
                                                                                    ));

            //maybe app restart, the process id was changed. need to refrush process id.
            if (element == null)
            {
                DesktopController.InitializeDesktop(_app);
                element =
                    AutomationElement.RootElement.FindFirst(TreeScope.Children,
                                                            new AndCondition(
                                                                new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window)
                                                                , new PropertyCondition(AutomationElement.NameProperty, name)
                                                                , new PropertyCondition(AutomationElement.ProcessIdProperty, DesktopController.DesktopProcess.Id)
                                                                ));
            }
            //still cannot get element
            if (element == null)
            {
                throw new Exception(string.Format("Cannot found window: {0}", name));
            }
            return(element);
        }
 public void Close()
 {
     if (!DesktopController.DesktopProcess.HasExited)
     {
         DesktopController.CloseDesktop();
     }
 }
Ejemplo n.º 3
0
    public virtual void Setup()
    {
        Transform win = transform.Find("Screen").Find("UI").Find("Canvas").Find("Windows");

        Numpad = win.parent.Find("Screen").GetComponentInChildren <NumpadController>();

        Sound = GetComponent <ComputerSounds>();
        Sound.Setup(this);

        Login = win.GetComponent <LoginController>();
        Login.Setup(this);

        Desktop = win.GetComponent <DesktopController>();
        Desktop.Setup();

        SS = win.GetComponent <StudentStress>();
        SS.Setup();

        Windows = win.GetComponent <ComputerWindows>();
        Windows.Setup(this);

        Calculator = win.GetComponent <CalculatorController>();
        Calculator.Setup();

        Question = win.GetComponent <QuestionController>();
        Question.Setup();

        Exam = win.GetComponent <ExamController>();

        Text = win.GetComponent <TextController>();
        Text.Setup();

        Commands = new ComputerCommands(this);
    }
Ejemplo n.º 4
0
        //  When New Game is clicked in TitleScreen.cs
        private void Desktop_Load(object sender, EventArgs e)
        {
            if (!CurrentSave.FTime95)
            {
                UpgradeFileSystem("98");
            }

            if (currentTheme.defaultWallpaper != null)
            {
                desktopicons.BackgroundImage = new Bitmap(currentTheme.defaultWallpaper, Width, Height);
            }
            //Start Menu Color - Commented until it works reliably
            //startmenuitems.Renderer = new MyRenderer();
            //ProgramsToolStripMenuItem.DropDown.Renderer = new MyRenderer();

            // Make Font Mandatory
            fontLoad();

            // Play Windows 95 Start Sound
            Stream audio = currentTheme.startSound;

            startsound = new SoundPlayer(audio);
            startsound.Play();

            // Hide the Startmenu
            startmenu.Hide();

            // Check for and set VM Mode
            if (this.FormBorderStyle != FormBorderStyle.None)
            {
                this.Text = "Histacom2 - VM Mode";
            }

            // Start the ClockTimer
            clockTimer.Start();

            // Set the StartMenu seperator
            startmenuitems.Items.Insert(6, new ToolStripSeparator());

            //nonimportantapps.Capacity = 100;
            this.SendToBack();

            // Update the taskbar
            UpdateTaskbar();

            // Bring to this the front
            this.BringToFront();

            // Update the desktop Icons!

            DesktopController.RefreshDesktopIcons(new ListViewItem[] { new System.Windows.Forms.ListViewItem("My Computer", 0),
                                                                       new System.Windows.Forms.ListViewItem("Network Neighborhood", 5),
                                                                       new System.Windows.Forms.ListViewItem("Inbox", 3),
                                                                       new System.Windows.Forms.ListViewItem("Recycle Bin", 7),
                                                                       new System.Windows.Forms.ListViewItem("Internet Explorer", 2),
                                                                       new System.Windows.Forms.ListViewItem("Online Services", 1),
                                                                       new System.Windows.Forms.ListViewItem("Set Up The Microsoft Network", 4),
                                                                       new System.Windows.Forms.ListViewItem("Outlook Express", 6) }, ref desktopicons, Path.Combine(ProfileWindowsDirectory, "Desktop"));
        }
Ejemplo n.º 5
0
 private void desktopupdate_Tick(object sender, EventArgs e)
 {
     DesktopController.RefreshDesktopIcons(new ListViewItem[] { new System.Windows.Forms.ListViewItem("My Computer", 0),
                                                                new System.Windows.Forms.ListViewItem("Network Neighborhood", 5),
                                                                new System.Windows.Forms.ListViewItem("Inbox", 3),
                                                                new System.Windows.Forms.ListViewItem("Recycle Bin", 7),
                                                                new System.Windows.Forms.ListViewItem("Internet Explorer", 2),
                                                                new System.Windows.Forms.ListViewItem("Online Services", 1),
                                                                new System.Windows.Forms.ListViewItem("Set Up The Microsoft Network", 4),
                                                                new System.Windows.Forms.ListViewItem("Outlook Express", 6) }, ref desktopicons, Path.Combine(ProfileWindowsDirectory, "Desktop"));
 }
Ejemplo n.º 6
0
 // Use this for initialization
 private void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     _desktopController  = GetComponent <DesktopController>();
     EmailController     = GetComponent <EmailController>();
     _scoreboard         = GetComponent <Scoreboard>();
     _nextSpamEmailTimer = Random.Range(minSpamTime, maxSpamTime);
 }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Product          product1 = new Product("12345", "laptop-dell");
            MobileController order1   = new MobileController(
                new DBInventoryService(),
                new ICICIPaymentService(),
                new FedExShippingService());

            order1.orderProduct(
                product1, 120, 2345, 112,
                new Address("1-1", "", "", ""));

            Product           product2 = new Product("12346", "mobile-oppo");
            DesktopController order2   = new DesktopController(
                new DBInventoryService(),
                new PayPalPaymentService(),
                new FedExShippingService());

            order2.orderProduct(product2, 120, 2341, 111,
                                new Address("1-2", "", "", ""));
        }
        public void Init()
        {
            if (DesktopController.InitializeDesktop(_app))
            {
                _bStartFromTestingTool = true;
            }

            //_regions = new Dictionary<string, string>(_app.Regions.Count);
            foreach (var r in _app.Regions)
            {
                bool     found = false;
                DateTime end   = DateTime.Now.AddMinutes(20);
                while (end > DateTime.Now)
                {
                    AutomationElement win = AutomationElement.RootElement.FindFirst(TreeScope.Children, new AndCondition(
                                                                                        new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Window),
                                                                                        new PropertyCondition(AutomationElement.NameProperty, r.Name),
                                                                                        new PropertyCondition(AutomationElement.ProcessIdProperty, DesktopController.DesktopProcess.Id)
                                                                                        ));
                    if (win != null)
                    {
                        found = true;
                        if (_currentRegionId == null)
                        {
                            _currentRegionId   = r.Id;
                            _currentRegionName = r.Name;
                        }
                        break;
                    }
                }
                if (!found)
                {
                    throw new Exception(string.Format("Cannot find window {0}", r.Name));
                }
            }
        }
Ejemplo n.º 9
0
 public frmDesktop()
 {
     InitializeComponent();
     controlador = new DesktopController();
 }
Ejemplo n.º 10
0
        //  When New Game is clicked in TitleScreen.cs
        private void Desktop_Load(object sender, EventArgs e)
        {
            if (currentTheme.defaultWallpaper != null)
            {
                desktopicons.BackgroundImage = new Bitmap(currentTheme.defaultWallpaper, Width, Height);
            }
            //Start Menu Color - Commented until it works reliably
            //startmenuitems.Renderer = new MyRenderer();
            //ProgramsToolStripMenuItem.DropDown.Renderer = new MyRenderer();

            // Make Font Mandatory
            fontLoad();

            // Play Windows 95 Start Sound
            Stream audio = currentTheme.startSound;

            startsound = new SoundPlayer(audio);
            startsound.Play();

            // Hide the Startmenu
            startmenu.Hide();

            // Check for and set VM Mode
            if (this.FormBorderStyle != FormBorderStyle.None)
            {
                this.Text = "Histacom2 - VM Mode";
            }

            // Start the ClockTimer
            clockTimer.Start();

            // Set the StartMenu seperator
            startmenuitems.Items.Insert(6, new ToolStripSeparator());

            //nonimportantapps.Capacity = 100;
            this.SendToBack();

            // Update the taskbar
            UpdateTaskbar();

            // Bring to this the front
            this.BringToFront();

            //Check if it is the first time
            if (CurrentSave.FTime95 == false)
            {
                CurrentSave.FTime95 = true;
                SaveGame();
                welcome = wm.StartWin95(new WinClassicWelcome(), "Welcome", null, false, false, resize: false);
                AddTaskBarItem(welcome, welcome.Tag.ToString(), "Welcome", null);

                nonimportantapps.Add(welcome);
                nonimportantapps[nonimportantapps.Count - 1].BringToFront();
                nonimportantapps[nonimportantapps.Count - 1].FormClosing += new FormClosingEventHandler(NonImportantApp_Closing);

                welcome.BringToFront();
                welcome.Activate();
            }

            // Update the Desktop icons

            DesktopController.RefreshDesktopIcons(new ListViewItem[] { new ListViewItem("My Computer", 0),
                                                                       new ListViewItem("Network Neighborhood", 5),
                                                                       new ListViewItem("Inbox", 3),
                                                                       new ListViewItem("Recycle Bin", 7),
                                                                       new ListViewItem("Internet Explorer", 2),
                                                                       new ListViewItem("Online Services", 1),
                                                                       new ListViewItem("Set Up The Microsoft Network", 4),
                                                                       new ListViewItem("Outlook Express", 6) }, ref desktopicons, Path.Combine(ProfileWindowsDirectory, "Desktop"));
            desktopicons.AutoArrange = false;
        }
Ejemplo n.º 11
0
        //  When New Game is clicked in TitleScreen.cs
        private void Desktop_Load(object sender, EventArgs e)
        {
            if (currentTheme.defaultWallpaper != null)
            {
                desktopicons.BackgroundImage = new Bitmap(currentTheme.defaultWallpaper, Width, Height);
            }

            // Make Font Mandatory
            fontLoad();

            // Play Windows 95 Start Sound
            Stream audio = currentTheme.startSound;

            startsound = new SoundPlayer(audio);
            startsound.Play();

            // Hide the Startmenu
            startmenu.Hide();

            // Check for and set VM Mode
            if (this.FormBorderStyle != FormBorderStyle.None)
            {
                this.Text = "Histacom2 - VM Mode";
            }

            // Start the ClockTimer
            clockTimer.Start();

            // Set the StartMenu seperator
            startmenuitems.Items.Insert(6, new ToolStripSeparator());

            //nonimportantapps.Capacity = 100;
            this.SendToBack();

            // Update the taskbar
            UpdateTaskbar();

            // Bring to this the front
            this.BringToFront();

            // Update the Desktop icons

            DesktopController.RefreshDesktopIcons(new ListViewItem[] { new ListViewItem("My Computer", 0),
                                                                       new ListViewItem("Network Neighborhood", 5),
                                                                       new ListViewItem("Inbox", 3),
                                                                       new ListViewItem("Recycle Bin", 7),
                                                                       new ListViewItem("Internet Explorer", 2),
                                                                       new ListViewItem("Online Services", 1),
                                                                       new ListViewItem("Set Up The Microsoft Network", 4),
                                                                       new ListViewItem("Outlook Express", 6) }, ref desktopicons, Path.Combine(ProfileWindowsDirectory, "Desktop"));
            desktopicons.AutoArrange = false;

            // Enable installed programs

            if (CurrentSave.installed95[0])
            {
                WebChatToolStripMenuItem.Visible = true;
            }
            if (CurrentSave.installed95[1])
            {
                FTPClientToolStripMenuItem.Visible = true;
            }
            if (CurrentSave.installed95[2])
            {
                StartRunnerToolStripMenuItem.Visible = true;
            }
            if (CurrentSave.installed95[3])
            {
                ErrorBlasterToolStripMenuItem.Visible = true;
            }
            if (CurrentSave.installed95[5])
            {
                TimeDistorterToolStripMenuItem.Visible = true;
            }
            if (CurrentSave.installed95[6])
            {
                GuessTheNumberToolStripMenuItem.Visible = true;
            }
        }
Ejemplo n.º 12
0
 public MainWindow()
 {
     InitializeComponent();
     DC = new DesktopController();
     GetData();
 }