Пример #1
0
        public MainWindow()
        {
            InitializeComponent();

            AllocConsole();


            //actionBT = new Tree();
            timerTest = new E7Timer(1500);
            actions   = new ObservableCollection <Action>();
            dcsTree   = new ObservableCollection <Node>();
            //designerListBox.ItemsSource = actions;
            nodeListView.ItemsSource = dcsTree;
            this.DataContext         = test;
            //hotkeys
            HotkeyManager.Current.AddOrReplace("StartOrStop", Key.F1, ModifierKeys.Shift, onStartHotkey);
            //
            cfg         = new Profile();
            imgName     = new KeyValueControl();
            imgName.Key = "firstName";
            timerTest.SetFunction(iterateThroughList);
            LoadProfile_OnClick(null, null);

            // Config.shutDowntime.SetFunction(Config.shutDownPc);
        }
Пример #2
0
        public void run()
        {
            Console.WriteLine(c.name);

            bool goNxt     = true;
            bool firstFail = false;

            if (timer == null)
            {
                timer = new E7Timer(1000);
                timer.SetFunction(nxtTimer);
            }

            if (!timer.isStart)
            {
                for (int i = 0; i < c.lActions.Count; i++)
                {
                    goNxt = c.lActions[i].run();

                    if (!goNxt && !firstFail)
                    {
                        firstFail = true;
                    }
                }

                if (c.left != null)
                {
                    c.left.active = !firstFail;

                    if (c.right != null && !c.left.active)
                    {
                        for (int i = 0; i < c.rActions.Count; i++)
                        {
                            goNxt = c.rActions[i].run();
                            if (!goNxt)
                            {
                                break;
                            }
                        }

                        c.right.active = goNxt;
                    }
                }
            }

            if (!goNxt && c.click)
            {
                VirtualMouse.LeftClick();
            }


            if (goNxt)
            {
                if (!timer.isStart)
                {
                    timer.Start();
                }
            }
        }
Пример #3
0
        public static void shutDownPc(Object source, ElapsedEventArgs e)
        {
            Console.Write("shutting down PC...");
            Profile shutdownCfg = SaveNLoad.deSerialize(Config.CFG_PATH + "ShutDownPc");

            shutdownCfg.actionBT.run();
            Thread.Sleep(2000);
            shutdownCfg.actionBT.run();
            E7Timer shutDown = new E7Timer(5000);

            shutDown.SetFunction(shutFct);
            shutDown.Start();
        }
Пример #4
0
 public void saveChk()
 {
     timer = null;
 }