Пример #1
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext     = CurrentData.Instance;
     dtimer          = new DispatcherTimer();
     dtimer.Interval = new TimeSpan(0, 0, 0, 0, 250);
     dtimer.Tick    += Dtimer_Tick;
     msg             = CurrentData.Instance.RedData;
     openFileDialog1 = new OpenFileDialog();
     player          = new System.Media.SoundPlayer();
     gcw             = new GreenScreenW();
 }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();
            gcwShowing          = false;
            state               = false;
            DataContext         = CurrentData.Instance;
            dtimer              = new DispatcherTimer();
            dtimer.Interval     = new TimeSpan(0, 0, 0, 0, 250);
            dtimer.Tick        += Dtimer_Tick;
            secondText          = new DispatcherTimer();
            secondText.Interval = new TimeSpan(0, 0, 0, 2);
            colorTextOn         = false;
            secondText.Tick    += secondText_Tick;
            // secondText.Start();

            isSettingRect   = false;
            msg             = CurrentData.Instance.RedData;
            openFileDialog1 = new OpenFileDialog();
            player          = new System.Media.SoundPlayer();
            gcwLocal        = new GreenScreenW();
            gcwSystem       = new GreenScreenW();
            //VRec = new System.Drawing.Rectangle();
            left   = Properties.Settings.Default.left;
            top    = Properties.Settings.Default.top;
            width  = Properties.Settings.Default.width;
            height = Properties.Settings.Default.height;
            try
            {
                sliverList = (List <Sliver>)StringToObject(Properties.Settings.Default.SliverList);
            }
            catch
            {
                sliverList = new List <Sliver>();
            }

            Saved.Text = $"{sliverList.Count}";
            if (left < 0)
            {
                left = 120;
            }
            if (top < 0)
            {
                top = 420;
            }

            if (width < 0)
            {
                width = 5;
            }

            if (height < 0)
            {
                height = 100;
            }
            outFolder.Text   = Properties.Settings.Default.outFolder;
            discordHook.Text = Properties.Settings.Default.discord;
            sLeft            = Properties.Settings.Default.sLeft;
            sTop             = Properties.Settings.Default.sTop;
            sWidth           = Properties.Settings.Default.sWidth;
            sHeight          = Properties.Settings.Default.sHeight;
            sc                   = new ScreenCapture();
            RedInSystem          = false;
            reds                 = 0;
            populateResult       = true;
            RedCheckStart        = DateTime.Now.AddSeconds(-5);
            waitASecond          = false;
            waitIterations       = 0;
            setRectangle         = true;
            GreenGrid.Visibility = Visibility.Visible;
            checkSystemCounter   = 0;
            isOutPathValid       = TestOutPath();
            keyDownTimer         = DateTime.Now;
            copyWidth.Text       = Properties.Settings.Default.cpyWidth;
            cidxCheck            = 0;
            populateNotificationData();
            this.dcList = new ColorData();
            setData();
            bool cal = false;

            if (sliverList == null || sliverList.Count == 0)
            {
                width = 300;
                setAbs();
                setUpRectangle();
            }
            foreach (var sl in sliverList)
            {
                if (sl.alertSoundFilename == null || sl.alertSoundFilename.Length < 2)
                {
                    sl.alertSoundFilename = Properties.Settings.Default.AlertSoundFile;
                }
                cal       = true;
                sl.Active = true;
                sl.hasRed = false;
                sl.width  = 300;
                bool calibrated = this.calibrate(sl);
                if (!calibrated)
                {
                    setUpRectangle();
                    cal = false;
                    return;
                }
            }
            startCheckNext();
            if (cal)
            {
                this.start();
                return;
            }
            width = 300;
            setAbs();
        }