示例#1
0
        protected override void OnStartup(StartupEventArgs args)
        {
            base.OnStartup(args);
            // Test whether or not to train the Machine by looking for the existence of various files.
            bool train = !Directory.Exists(FileUtilities.DirectoryName) || !File.Exists(FileUtilities.DirectoryName + "\\" + FileUtilities.AssetIndexData) ||
                         !File.Exists(FileUtilities.DirectoryName + "\\" + FileUtilities.CoreImageData);

            if (train)
            {
                InputSelection i = new InputSelection(train, false, "ADMIN", InputSelection.TrainTitle, machine.MainWindow.TrainTitle, FaceIdentity.FaceAdmin);
                i.Show();
            }
            else
            {
                InputSelection i = new InputSelection(train, true, "", InputSelection.ExecutionTitle, machine.MainWindow.ExecutionTitle, FaceIdentity.FaceNone);
                i.Show();
            }
        }
示例#2
0
 private void timerTick(object sender, EventArgs args)
 {
     if (count < list.Length)
     {
         textField.Text = list[count].ToUpper();
     }
     else if (!inputSelectionShown)
     {
         if (trainMachine)
         {
             inputSelection = new InputSelection(trainMachine, false, "ADMIN", InputSelection.TrainTitle, machine.MainWindow.TrainTitle, FaceIdentity.FaceAdmin, new MachineStartPage(trainMachine, uikind), uikind);
         }
         else
         {
             inputSelection = new InputSelection(trainMachine, true, "", InputSelection.ExecutionTitle, machine.MainWindow.ExecutionTitle, FaceIdentity.FaceNone, new MachineStartPage(trainMachine, uikind), uikind);
         }
         inputSelection.Show();
         inputSelectionShown = true;
     }
     Dispatcher.Invoke(delegate
     {
         if (count == 0)
         {
             canvas.Children.Add(line);
             canvas.Children.Add(line2);
             line.Stroke          = Brushes.Black;
             line.StrokeThickness = 2;
             line.X1               = 0;
             line.Y1               = 0;
             line2.Stroke          = Brushes.Black;
             line2.StrokeThickness = 2;
             line2.X1              = 0;
             line2.Y1              = 0;
         }
         Storyboard storyBoard = new Storyboard();
         DoubleAnimation da    = new DoubleAnimation(line.X2, textField.ActualWidth / 2 + 10, new Duration(new TimeSpan(0, 0, 0, 0, 250)));
         Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)"));
         storyBoard.Children.Add(da);
         storyBoard.Completed += (s, e) =>
         {
             if (count + 1 < list.Length && list[count].Length != list[count + 1].Length)
             {
                 canvas.InvalidateVisual();
             }
         };
         line.BeginStoryboard(storyBoard);
         Storyboard storyBoard2 = new Storyboard();
         DoubleAnimation da2    = new DoubleAnimation(line2.X2, -textField.ActualWidth / 2 - 10, new Duration(new TimeSpan(0, 0, 0, 0, 250)));
         Storyboard.SetTargetProperty(da2, new PropertyPath("(Line.X2)"));
         storyBoard2.Children.Add(da2);
         storyBoard2.Completed += (s, e) =>
         {
             if (count + 1 < list.Length && list[count].Length != list[count + 1].Length)
             {
                 canvas.InvalidateVisual();
             }
         };
         line2.BeginStoryboard(storyBoard2);
     }, DispatcherPriority.ApplicationIdle);
     count++;
 }
 private void timerTick(object sender, EventArgs args)
 {
     if (creditsPart)
     {
         Tuple <int, int> tup = printNonCyclicText(credits, line, pos);
         line = tup.Item1;
         pos  = tup.Item2;
         if (line >= credits.Length)
         {
             creditsPart            = false;
             firstPart              = true;
             line                   = 0;
             pos                    = 0;
             machineText.Text       = "";
             dispatchTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
             Thread.Sleep(500);
         }
     }
     else if (firstPart)
     {
         Tuple <int, int> tup = printNonCyclicText(systemBootPart1, line, pos);
         line = tup.Item1;
         pos  = tup.Item2;
         if (line >= systemBootPart1.Length)
         {
             firstPart        = false;
             secondPart       = true;
             line             = 0;
             pos              = 0;
             machineText.Text = "";
         }
     }
     else if (secondPart)
     {
         Tuple <int, int> tup = printNonCyclicText(systemBootPart2, line, pos);
         line = tup.Item1;
         pos  = tup.Item2;
         if (line >= systemBootPart2.Length)
         {
             secondPart       = false;
             thirdPart        = true;
             line             = 0;
             pos              = 0;
             machineText.Text = "";
         }
     }
     else if (thirdPart)
     {
         Tuple <int, int> tup = printCyclicText(systemBootPart3, line, pos);
         line = tup.Item1;
         pos  = tup.Item2;
     }
     else if (fourthPart)
     {
         Tuple <int, int> tup = printCyclicText(systemBootPart4, line, pos);
         line = tup.Item1;
         pos  = tup.Item2;
     }
     else
     {
         dispatchTimer.Stop();
     }
     if (seekedAdmin && !initialWindowShown)
     {
         if (trainMachine)
         {
             inputSelection = new InputSelection(trainMachine, false, "ADMIN", InputSelection.TrainTitle, machine.MainWindow.TrainTitle, FaceIdentity.FaceAdmin, this, uikind);
         }
         else
         {
             inputSelection = new InputSelection(trainMachine, true, "", InputSelection.ExecutionTitle, machine.MainWindow.ExecutionTitle, FaceIdentity.FaceNone, this, uikind);
         }
         inputSelection.Show();
         mainWindow         = inputSelection.GetMainWindow();
         seekedAdmin        = false;
         initialWindowShown = true;
     }
 }
 private void timerTick(object sender, EventArgs args)
 {
     if (creditsPart)
     {
         Tuple<int, int> tup = printNonCyclicText(credits, line, pos);
         line = tup.Item1;
         pos = tup.Item2;
         if (line >= credits.Length)
         {
             creditsPart = false;
             firstPart = true;
             line = 0;
             pos = 0;
             machineText.Text = "";
             dispatchTimer.Interval = new TimeSpan(0, 0, 0, 0, 1);
             Thread.Sleep(500);
         }
     }
     else if (firstPart)
     {
         Tuple<int, int> tup = printNonCyclicText(systemBootPart1, line, pos);
         line = tup.Item1;
         pos = tup.Item2;
         if (line >= systemBootPart1.Length)
         {
             firstPart = false;
             secondPart = true;
             line = 0;
             pos = 0;
             machineText.Text = "";
         }
     }
     else if (secondPart)
     {
         Tuple<int, int> tup = printNonCyclicText(systemBootPart2, line, pos);
         line = tup.Item1;
         pos = tup.Item2;
         if (line >= systemBootPart2.Length)
         {
             secondPart = false;
             thirdPart = true;
             line = 0;
             pos = 0;
             machineText.Text = "";
         }
     }
     else if (thirdPart)
     {
         Tuple<int, int> tup = printCyclicText(systemBootPart3, line, pos);
         line = tup.Item1;
         pos = tup.Item2;
     }
     else if (fourthPart)
     {
         Tuple<int, int> tup = printCyclicText(systemBootPart4, line, pos);
         line = tup.Item1;
         pos = tup.Item2;
     }
     else
         dispatchTimer.Stop();
     if (seekedAdmin && !initialWindowShown)
     {
         if (trainMachine)
             inputSelection = new InputSelection(trainMachine, false, "ADMIN", InputSelection.TrainTitle, machine.MainWindow.TrainTitle, FaceIdentity.FaceAdmin, this, uikind);
         else
             inputSelection = new InputSelection(trainMachine, true, "", InputSelection.ExecutionTitle, machine.MainWindow.ExecutionTitle, FaceIdentity.FaceNone, this, uikind);
         inputSelection.Show();
         mainWindow = inputSelection.GetMainWindow();
         seekedAdmin = false;
         initialWindowShown = true;
     }
 }
 private void timerTick(object sender, EventArgs args)
 {
     if (count < list.Length)
         textField.Text = list[count].ToUpper();
     else if (!inputSelectionShown)
     {
         if (trainMachine)
             inputSelection = new InputSelection(trainMachine, false, "ADMIN", InputSelection.TrainTitle, machine.MainWindow.TrainTitle, FaceIdentity.FaceAdmin, new MachineStartPage(trainMachine, uikind), uikind);
         else
             inputSelection = new InputSelection(trainMachine, true, "", InputSelection.ExecutionTitle, machine.MainWindow.ExecutionTitle, FaceIdentity.FaceNone, new MachineStartPage(trainMachine, uikind), uikind);
         inputSelection.Show();
         inputSelectionShown = true;
     }
     Dispatcher.Invoke(delegate
     {
         if (count == 0)
         {
             canvas.Children.Add(line);
             canvas.Children.Add(line2);
             line.Stroke = Brushes.Black;
             line.StrokeThickness = 2;
             line.X1 = 0;
             line.Y1 = 0;
             line2.Stroke = Brushes.Black;
             line2.StrokeThickness = 2;
             line2.X1 = 0;
             line2.Y1 = 0;
         }
         Storyboard storyBoard = new Storyboard();
         DoubleAnimation da = new DoubleAnimation(line.X2, textField.ActualWidth / 2 + 10, new Duration(new TimeSpan(0, 0, 0, 0, 250)));
         Storyboard.SetTargetProperty(da, new PropertyPath("(Line.X2)"));
         storyBoard.Children.Add(da);
         storyBoard.Completed += (s, e) =>
         {
             if (count + 1 < list.Length && list[count].Length != list[count + 1].Length)
                 canvas.InvalidateVisual();
         };
         line.BeginStoryboard(storyBoard);
         Storyboard storyBoard2 = new Storyboard();
         DoubleAnimation da2 = new DoubleAnimation(line2.X2, -textField.ActualWidth / 2 - 10, new Duration(new TimeSpan(0, 0, 0, 0, 250)));
         Storyboard.SetTargetProperty(da2, new PropertyPath("(Line.X2)"));
         storyBoard2.Children.Add(da2);
         storyBoard2.Completed += (s, e) =>
         {
             if (count + 1 < list.Length && list[count].Length != list[count + 1].Length)
                 canvas.InvalidateVisual();
         };
         line2.BeginStoryboard(storyBoard2);
     }, DispatcherPriority.ApplicationIdle);
     count++;
 }