Exemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((base.GetHashCode() * 397) ^ InputName.GetHashCode());
     }
 }
 public PackagesDialogViewModel()
 {
     _windowInputName = new InputName();
     RemoveTextField  = new RelayCommand(obj => TextField.Remove(obj as TextFieldModel));
     SavingPack       = new RelayCommand(obj => SavingPackage());
     Messenger.Default.Register <InfoMessage>(this, action => InputCustomName(action.Name));
 }
 public LogitechDrivingForceGTChangedEventArgs(LogitechDrivingForceGT device, InputName changedName, InputType changedType, object oldValue, object newValue)
 {
     this.Device = device;
     this.ChangedName = changedName;
     this.ChangedType = changedType;
     this.OldValue = oldValue;
     this.NewValue = newValue;
 }
Exemplo n.º 4
0
 public SendPage EnterName(string name)
 {
     if (InputName.Displayed)
     {
         InputName.SendKeys(name);
     }
     return(this);
 }
Exemplo n.º 5
0
 public InputData(Vector2?move, Vector2?look, bool?jump, bool?fire, InputName inputName)
 {
     Move      = move;
     Look      = look;
     Jump      = jump;
     Fire      = fire;
     InputName = inputName;
 }
Exemplo n.º 6
0
 private void Awake()
 {
     instance     = this;
     click.volume = SoundManager.instance.ClickSound.volume;
     clickVolume  = SoundManager.instance.volumeClick;
     bgmVolume    = SoundManager.instance.volumeBgm;
     Destroy(SoundManager.instance.gameObject);
 }
Exemplo n.º 7
0
 public void EnterName(string name)
 {
     logger.Info("Put name");
     if (InputName.Displayed)
     {
         InputName.SendKeys(name);
     }
     ;
 }
Exemplo n.º 8
0
        public EAPageObject Login(string userName, string password)
        {
            //UserName
            InputName.EnterText(userName);
            //password
            InputPassword.EnterText(password);
            //Click button
            btnLogin.Submit();

            //Return the page object
            return(new EAPageObject());
        }
Exemplo n.º 9
0
 private void Change_Click(object sender, RoutedEventArgs e)
 {
     if (!ExistNameList.Contains(InputName.Text))
     {
         DialogResult = true;
     }
     else
     {
         Utils.DialogService.ShowSimpleTextDialog("Warning", "해당 이름이 이미 사용중입니다.");
         InputName.Focus();
         InputName.SelectionStart = InputName.Text.Length;
     }
 }
Exemplo n.º 10
0
        private void SaveAuthor()
        {
            if (InputName == "" || InputAffiliation == "" || InputManuscriptTitle == "" ||
                InputEmailAddress == "" || InputMailingAddress == "" || InputPassword == "" ||
                InputPassword == "")
            {
                MessageBox.Show($"Please fill in all fields.",
                                "Error!",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
            else
            {
                //Manucript
                Random rnd = new Random();
                ManuscriptToAdd.EditorId         = rnd.Next(1, 6);
                ManuscriptToAdd.ManuscriptTitle  = InputManuscriptTitle;
                ManuscriptToAdd.DateReceived     = DateTime.Now;
                ManuscriptToAdd.ManuscriptStatus = 1;
                _addSingleManuscriptService.AddSingleManuscript(ManuscriptToAdd);

                //Author
                var authorFirstName  = InputName.Split(' ').First();
                var singleManuscript = ManuscriptList.Last();
                AuthorToAdd.ManuscriptsId.Add(singleManuscript.ManuscriptId + 1);
                AuthorToAdd.Name           = InputName;
                AuthorToAdd.MailingAddress = InputMailingAddress;
                AuthorToAdd.EmailAddress   = InputEmailAddress;
                AuthorToAdd.Affiliation    = InputAffiliation;
                AuthorToAdd.Username       = InputUsername;
                AuthorToAdd.Password       = ComputeSha256Hash(InputPassword);
                _addAuthorService.AddAuthor(AuthorToAdd);

                InputName            = "";
                InputMailingAddress  = "";
                InputEmailAddress    = "";
                InputAffiliation     = "";
                InputUsername        = "";
                InputPassword        = "";
                InputManuscriptTitle = "";

                MessageBox.Show($"Thank you for registering, {authorFirstName}! May more amazing manuscripts be published with your skills!",
                                "Success!",
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Peforms guest user registration and generates a JWT.
        /// </summary>
        /// <returns>A JSON response containing a JWT.</returns>
        public async Task <IActionResult> OnPostAcquireTokenAsync()
        {
            if (ModelState.IsValid)
            {
                _logger.LogInformation("The user attempted to login");

                var serviceProvider        = HttpContext.RequestServices;
                var authenticationProvider = (AuthenticationProvider)
                                             serviceProvider.GetService(typeof(AuthenticationProvider));

                // TODO: This is fragile. Make stronger in Elderberry.
                var userNameEscaped     = InputName.Replace(" ", "+");
                var inputRoomLowercased = InputRoom.ToLowerInvariant();
                var email = $"{InputName.ToLowerInvariant().Replace(" ", "")}@{inputRoomLowercased}";

                var result = await authenticationProvider.Register(new UserDetails()
                {
                    Username = userNameEscaped,
                    Email    = email,
                });

                if (!result.Succeeded)
                {
                    ModelState.AddModelError(string.Empty, "A user by that name already exists in this room.");
                    return(Page());
                }

                var token = await authenticationProvider.Login(new LoginCredentials()
                {
                    Email = email,
                });

                if (token is null)
                {
                    ModelState.AddModelError(string.Empty, "An error occurred when trying to join the room.");
                    return(Page());
                }

                // Redirect back, with the token.
                ViewData["Token"] = token;
                return(Page());
            }

            // If we got this far, something failed, redisplay form
            _logger.LogError("The model state was not valid.");
            return(Page());
        }
Exemplo n.º 12
0
    void AssignInput()
    {
        switch (currentInput)
        {
        case InputState.PC:
            InputName.Init("?");
            break;

        case InputState.PLAYSTATION:
            InputName.Init("PS");
            break;

        case InputState.XBOX:
            InputName.Init("XB");
            break;
        }
    }
        private IEnumerator Initialize()
        {
            SetStatus(StandardStatus.INITIALIZATION_RUNNING);
            SetStatus(StandardStatus.INITIALIZATION_WAITING);

            yield return(new WaitWhile(() => GameManager.Instance == null));

            yield return(new WaitWhile(() => GameManager.Instance.InputManager == null));

            yield return(new WaitWhile(() => !GameManager.Instance.InputManager.IsInitialized));

            SetStatus(StandardStatus.INITIALIZATION_RUNNING);

            if (m_chirality == HandSide.Left)
            {
                m_gripInputName       = InputName.GripLeftAxis;
                m_indexInputName      = InputName.IndexLeftAxis;
                m_faceFrontButtonName = InputName.FaceFrontLeftButton;
                m_faceBackButtonName  = InputName.FaceBackLeftButton;
            }
            else if (m_chirality == HandSide.Right)
            {
                m_gripInputName       = InputName.GripRightAxis;
                m_indexInputName      = InputName.IndexRightAxis;
                m_faceFrontButtonName = InputName.FaceFrontRightButton;
                m_faceBackButtonName  = InputName.FaceBackRightButton;
            }
            else
            {
                SetStatus(StandardStatus.INITIALIZATION_STOPPED_ERROR);
                yield break;
            }

            var inputStates = GameManager.Instance.InputManager.InputStates;

            inputStates[m_gripInputName].OnValueChanged.AddListener(OnGripValueChanged);
            inputStates[m_gripInputName].OnInputUp.AddListener(OnGripUp);
            inputStates[m_gripInputName].OnInputDown.AddListener(OnGripDown);
            inputStates[m_indexInputName].OnValueChanged.AddListener(OnIndexValueChanged);
            inputStates[m_indexInputName].OnInputUp.AddListener(OnIndexUp);
            inputStates[m_indexInputName].OnInputDown.AddListener(OnIndexDown);
            inputStates[m_faceFrontButtonName].OnInputDown.AddListener(OnAnyFaceButtonDown);
            inputStates[m_faceBackButtonName].OnInputDown.AddListener(OnAnyFaceButtonDown);

            SetInitialized($"Initialization as {m_chirality} hand finished");
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // I want to know if this page is being rendered for the very first
            // time (not Page.IsPostBack), or if the page is simply being posted back
            // in response to something occuring with the form.

            List <ServersTable> servers = new List <ServersTable>();

            // If this is the first time the page is rendered then load the
            // servers data from the database. We get all of the servers from the
            // database and then save that data as a list to "session state."
            if (!Page.IsPostBack)
            {
                using (var db = new Tipout())
                {
                    var serversList = db.ServersTable
                                      .OrderBy(q => q.NameLast)
                                      .Select(q => new
                    {
                        Item  = q.NameLast + ", " + q.NameFirst,
                        Value = q.ID
                    })
                                      .ToList();

                    Session["servers"] = serversList;
                }
            }

            // Whether the page is being loaded for the very first time or any other
            // time after some response to a control on the form we need to reload
            // the drop down list control. We are going to reload it from
            // session state.

            svrName.DataTextField  = "Item";
            svrName.DataValueField = "Value";
            svrName.DataSource     = Session["servers"];
            svrName.DataBind();
            svrName.SelectedIndex = -1;

            InputName.DataTextField  = "Item";
            InputName.DataValueField = "Value";
            InputName.DataSource     = Session["servers"];
            InputName.DataBind();
            InputName.SelectedIndex = -1;
        }
Exemplo n.º 15
0
        /// <summary>
        /// INGRESA UN USUARIO NUEVO AL SISTEMA
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            InputName     user_input    = new InputName();
            usuarioClass  nuevo_usuario = new usuarioClass();
            cuadroMensaje mensaje       = new cuadroMensaje();

            if (DialogResult.OK == user_input.ShowDialog())
            {
                if (nuevo_usuario.fnIngresaUsuario(user_input.userName, user_input.userPaterno, user_input.userMaterno, user_input.userGenero, user_input.userEdad, user_input.userRol, user_input.userPuesto, user_input.userCorreo, "jorbee2020", user_input.userPathImagen))
                {
                    mensaje.fnCargarMensaje("SE AGREGO EL USUARIO");
                    mensaje.Show();
                }
                else
                {
                    mensaje.fnCargarMensaje("ERROR: NO SE AGREGO EL USUARIO");
                    mensaje.Show();
                }
            }
        }
        private void SaveReviewer()
        {
            if (InputName == "" || InputAffiliation == "" || InputEmailAddress == "" || InputPassword == "" ||
                InputPassword == "")
            {
                MessageBox.Show($"Please fill in all fields.",
                                "Error!",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
            else
            {
                var reviewerFirstName       = InputName.Split(' ').First();
                var selectedAreaOfInterests = FrontAreaOfInterestList.Where(c => c.IsSelected);
                foreach (var dto in selectedAreaOfInterests)
                {
                    ReviewerToAdd.AreaOfInterestsId.Add(dto.AreaOfInterestId);
                }
                ReviewerToAdd.Name         = InputName;
                ReviewerToAdd.EmailAddress = InputEmailAddress;
                ReviewerToAdd.Affiliation  = InputAffiliation;
                ReviewerToAdd.Username     = InputUsername;
                ReviewerToAdd.Password     = ComputeSha256Hash(InputPassword);
                _addReviewerService.AddReviewer(ReviewerToAdd);

                InputName         = "";
                InputEmailAddress = "";
                InputAffiliation  = "";
                InputUsername     = "";
                InputPassword     = "";
                foreach (var areaOfInterest in FrontAreaOfInterestList)
                {
                    areaOfInterest.IsSelected = false;
                }
                MessageBox.Show($"Thank you for registering, {reviewerFirstName}! May more amazing manuscripts be published with your skills!",
                                "Success!",
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);
            }
        }
Exemplo n.º 17
0
        public static VisualElement BuildStringWrapperEditor(this IConstantEditorBuilder builder, IStringWrapperConstantModel icm)
        {
            var enumEditor = new Button {
                text = icm.ObjectValue.ToString()
            };                                                                 // TODO use a bindable element

            enumEditor.clickable.clickedWithEventInfo += e =>
            {
                List <string> allInputNames = icm.GetAllInputNames();
                SearcherService.ShowValues("Pick a value", allInputNames, e.originalMousePosition, (v, pickedIndex) =>
                {
                    var oldValue = new InputName {
                        name = icm.StringValue
                    };
                    var newValue    = oldValue;
                    newValue.name   = v;
                    enumEditor.text = v;
                    builder.TriggerOnValueChanged(oldValue, newValue);
                });
            };
            enumEditor.SetEnabled(!icm.IsLocked);
            return(enumEditor);
        }
Exemplo n.º 18
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (InputName.Length != 0)
            {
                hash ^= InputName.GetHashCode();
            }
            if (topicSourceCase_ == TopicSourceOneofCase.Topic)
            {
                hash ^= Topic.GetHashCode();
            }
            if (topicSourceCase_ == TopicSourceOneofCase.TopicMux)
            {
                hash ^= TopicMux.GetHashCode();
            }
            hash ^= (int)topicSourceCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 19
0
    private void InitInput()
    {
        if (!string.IsNullOrEmpty(InputName))
        {
            divInput.Controls.Add(new Label {
                ID = LabelPrefix + InputName.Replace(" ", string.Empty), Text = String.Format("<span>{0}:</span>", InputName)
            });

            TextBox tb = new TextBox {
                ID = TextBoxPrefix + InputName.Replace(" ", string.Empty)
            };

            if (!string.IsNullOrEmpty(InputMaxLength))
            {
                int tbMaxLength;
                if (Int32.TryParse(InputMaxLength, out tbMaxLength))
                {
                    tb.MaxLength = tbMaxLength;
                }
            }

            divInput.Controls.Add(tb);
        }
    }
Exemplo n.º 20
0
        private void Add()
        {
            Task.WaitAll(Task.Run(async() => await Load()));
            if (Block == null || Status == null || InputName == String.Empty || InputName == null)
            {
                MessageBox.Show("You must fill in all fields first!", "Notification", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                return;
            }
            var temp = InputName.Insert(0, Block);

            if (!CheckInputName(temp))
            {
                MessageBox.Show("Name has existed, choose other name!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            DataAccess.DataModels.Slot item = new DataAccess.DataModels.Slot
            {
                ID           = $"HCMUTEPL{temp}",
                Name         = temp,
                Status       = Status,
                Availability = "Yes",
                BlockID      = $"HCMUTEPL{Block}"
            };

            var updateblock = _blocksList.Find(param => param.ID == item.BlockID);

            updateblock.NumberOfSlots++;

            var task1 = Task.Run(async() => await _blocksRepository.UpdateBlockAsync(updateblock));

            var task2 = Task.Run(async() => await _slotsRepository.AddSlotAsync(item));

            Task.WaitAll(task1, task2);
            InputName = String.Empty;
            MessageBox.Show("Slot has been added!", "Successful", MessageBoxButton.OK, MessageBoxImage.Asterisk);
        }
Exemplo n.º 21
0
 public string getInputName(InputName inputName)
 {
     return("P" + this.controllerNumber + inputName.ToString());
 }
Exemplo n.º 22
0
 public override int GetHashCode()
 {
     return(InputName.GetHashCode());
 }
Exemplo n.º 23
0
 public override int GetHashCode()
 {
     return(InputName != null?InputName.GetHashCode() : 0);
 }
Exemplo n.º 24
0
        static void Main(string[] args)
        {
            //opgave 3.1
            string InputDate;
            string date;

            Console.WriteLine("Indtast dagnummeret 1-7");
            InputDate = Console.ReadLine();

            switch (InputDate)
            {
            case "1":
                date = "Mandag";
                break;

            case "2":
                date = "tirsdag";
                break;

            case "3":
                date = "onsdag";
                break;

            case "4":
                date = "torsdag";
                break;

            case "5":
                date = "fredag";
                break;

            case "6":
                date = "lørdag";
                break;

            case "7":
                date = "søndag";
                break;

            default:
                date = "";
                break;
            }

            if (date != "")
            {
                Console.WriteLine("I dag er det {0}", date);
            }
            else
            {
                Console.WriteLine("Invalid input");
            }

            //opgave 3.2

            string InputCelc;
            string InputTemp;
            double celc;
            double OutputTemp;
            string TempType;

            Console.WriteLine("Indtast temperatur i celcius");
            InputCelc = Console.ReadLine();

            if (double.TryParse(InputCelc, out celc))
            {
                Console.WriteLine("Indtast k for kelvin, f for fahrenheit, R for Réaumur");
                InputTemp = Console.ReadLine();
                switch (InputTemp.ToLower())
                {
                case "k":
                    OutputTemp = celc + 273.15;
                    TempType   = "Kelvin";
                    break;

                case "f":
                    OutputTemp = (celc * (9.00 / 5.00)) + 32.00;
                    TempType   = "Fahrenheit";
                    break;

                case "r":
                    OutputTemp = celc * 0.8;
                    TempType   = "Réaumur";
                    break;

                default:
                    OutputTemp = 0;
                    InputTemp  = "";
                    TempType   = "";
                    break;
                }
                if (TempType != "")
                {
                    Console.WriteLine("Celcius {0} er lig med {1} {2}", celc, OutputTemp, TempType);
                }
                else
                {
                    Console.WriteLine("Invalid input, k, f eller r for udregning");
                }
            }
            else
            {
                Console.WriteLine("Invalid number");
            }

            //opgave 4

            string InputTable;
            int    Table;
            int    count = 1;

            Console.WriteLine("Indtast tabel du vil have udregnet");
            InputTable = Console.ReadLine();

            if (int.TryParse(InputTable, out Table))
            {
                while (count * Table < 100)
                {
                    Console.WriteLine(" {0} x {1} : {2}", count, Table, Table * count);
                    count = count + 1;
                }
            }
            else
            {
                Console.WriteLine("Invalid Input");
            }

            //opgave 4.1
            string InputVertical;
            string InputHorizontal;
            int    Vertical;
            int    Horizontal;

            Console.WriteLine("Indtast vandret start");
            InputHorizontal = Console.ReadLine();

            Console.WriteLine("Indtast lodret start");
            InputVertical = Console.ReadLine();

            if (int.TryParse(InputHorizontal, out Horizontal) && int.TryParse(InputVertical, out Vertical))
            {
                Console.SetCursorPosition(Horizontal, Vertical);
                Console.WriteLine("┌────────┐");
                Console.SetCursorPosition(Horizontal, Vertical + 1);
                Console.WriteLine("│        │");
                Console.SetCursorPosition(Horizontal, Vertical + 2);
                Console.WriteLine("│        │");
                Console.SetCursorPosition(Horizontal, Vertical + 3);
                Console.WriteLine("│        │");
                Console.SetCursorPosition(Horizontal, Vertical + 4);
                Console.WriteLine("└────────┘");
            }
            else
            {
                Console.WriteLine("Invalid input");
            }

            //opgave 4.5

            String InputSlut;
            int    SlutCount = 0;

            while (true)
            {
                Console.WriteLine("Indtast tekst, s**t for at afslutte");
                InputSlut = Console.ReadLine();

                if (InputSlut.ToLower() != "s**t")
                {
                    SlutCount = SlutCount + 1;
                    Console.WriteLine("{0}", InputSlut);
                }
                else
                {
                    SlutCount = SlutCount + 1;
                    Console.WriteLine("Antal gange programmet kørte: {0}", SlutCount);
                    break;
                }
            }

            //opgave 5.1 && 5.2

            double Fahrenheit;

            for (double Celcius = 10; Celcius <= 100; Celcius = Celcius + 10)
            {
                Fahrenheit = (Celcius * (9.00 / 5.00)) + 32.00;
                Console.WriteLine("{0} Celcius er {1} Fahrenheit", Celcius, Fahrenheit);
            }

            //opgave 5.3

            for (int i = 0; i < 20; i++)
            {
                if (i % 2 == 0)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Blue;
                }
                Console.WriteLine("Tekst med farve");
            }

            Console.ForegroundColor = ConsoleColor.White;

            //opgave 6.1
            string InputRadius;
            double Radius;
            double Circumference;

            Console.WriteLine("Indtast radius af cirklen");
            InputRadius = Console.ReadLine();

            if (double.TryParse(InputRadius, out Radius))
            {
                Circumference = (2 * Radius) * Math.PI;
                Console.WriteLine("Omkreds er {0}", Circumference);
            }
            else
            {
                Console.WriteLine("invalid input");
            }

            //opgave 7.1

            string Lorem      = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
            int    SpaceCount = 0;
            int    Index      = 0;


            while (true)
            {
                if (Index != -1)
                {
                    Index      = Lorem.IndexOf(" ");
                    SpaceCount = SpaceCount + 1;
                    Lorem      = Lorem.Substring(Index + 1);
                    Index      = Lorem.IndexOf(" ");
                }
                else
                {
                    Console.WriteLine("{0} mellemrum", SpaceCount);
                    break;
                }
            }



            //opgave 7.2
            string Lorem1 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";

            Lorem1 = Lorem1.Replace(" ", "\n");

            Console.WriteLine(Lorem1);

            //opgave 7.3
            string InputName;
            int    UppercaseCount = 0;
            string Substring      = "";

            Console.WriteLine("Indtast fulde navn");
            InputName = Console.ReadLine();

            while (UppercaseCount < InputName.Length)
            {
                if (InputName.Substring(UppercaseCount, 1) != "")
                {
                    if (UppercaseCount == 0)
                    {
                        Substring      = Substring + InputName.Substring(UppercaseCount, 1).ToUpper();
                        UppercaseCount = UppercaseCount + 1;
                    }
                    else if (InputName.Substring(UppercaseCount - 1, 1) == " ")
                    {
                        Substring      = Substring + InputName.Substring(UppercaseCount, 1).ToUpper();
                        UppercaseCount = UppercaseCount + 1;
                    }
                    else
                    {
                        Substring      = Substring + InputName.Substring(UppercaseCount, 1).ToLower();
                        UppercaseCount = UppercaseCount + 1;
                    }
                }
            }
            Console.WriteLine(Substring);

            //opgave 8.1
            ArrayList Måneder = new ArrayList();

            Måneder.Add("Januar");
            Måneder.Add("Februar");
            Måneder.Add("Marts");
            Måneder.Add("April");
            Måneder.Add("Maj");
            Måneder.Add("Juni");
            Måneder.Add("Juli");
            Måneder.Add("August");
            Måneder.Add("September");
            Måneder.Add("Oktober");
            Måneder.Add("November");
            Måneder.Add("December");

            foreach (string Måned in Måneder)
            {
                if (Måned.Substring(0, 1).ToLower() == "a")
                {
                    Console.WriteLine(Måned);
                }
            }

            Måneder.Sort();

            foreach (string Måned in Måneder)
            {
                if (Måned.Length > 4)
                {
                    Console.WriteLine(Måned);
                }
            }

            Måneder.Add("Bichat");

            foreach (string Måned in Måneder)
            {
                Console.WriteLine(Måned);
            }
        }
 public void play()
 {
     MainMenu.SetActive(false);
     InputName.SetActive(true);
 }
Exemplo n.º 26
0
        private void Start(string MediaPath, int SelectedIndex)
        {
            int cameraHandle = 0;

            int r = FSDKCam.OpenVideoCamera(ref cameraName, ref cameraHandle);

            if (r != FSDK.FSDKE_OK)
            {
                MessageBox.Show("Error opening the first camera", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }

            int tracker = 0;                                                                     // creating a Tracker

            if (FSDK.FSDKE_OK != FSDK.LoadTrackerMemoryFromFile(ref tracker, TrackerMemoryFile)) // try to load saved tracker state
            {
                FSDK.CreateTracker(ref tracker);                                                 // if could not be loaded, create a new tracker
            }
            int err = 0;                                                                         // set realtime face detection parameters

            FSDK.SetTrackerMultipleParameters(tracker, "HandleArbitraryRotations=false; DetermineFaceRotationAngle=false; InternalResizeWidth=100; FaceDetectionThreshold=5;", ref err);

            while (!needClose)
            {
                Int32 imageHandle = 0;
                if (FSDK.FSDKE_OK != FSDKCam.GrabFrame(cameraHandle, ref imageHandle)) // grab the current frame from the camera
                {
                    Application.DoEvents();
                    continue;
                }
                FSDK.CImage image = new FSDK.CImage(imageHandle);

                long[] IDs;
                long   faceCount = 0;
                FSDK.FeedFrame(tracker, 0, image.ImageHandle, ref faceCount, out IDs, sizeof(long) * 256); // maximum of 256 faces detected
                Array.Resize(ref IDs, (int)faceCount);

                // make UI controls accessible (to find if the user clicked on a face)
                Application.DoEvents();

                Image    frameImage = image.ToCLRImage();
                Graphics gr         = Graphics.FromImage(frameImage);

                for (int i = 0; i < IDs.Length; ++i)
                {
                    FSDK.TFacePosition facePosition = new FSDK.TFacePosition();
                    FSDK.GetTrackerFacePosition(tracker, 0, IDs[i], ref facePosition);

                    int left = facePosition.xc - (int)(facePosition.w * 0.6);
                    int top  = facePosition.yc - (int)(facePosition.w * 0.5);
                    int w    = (int)(facePosition.w * 1.2);

                    int res = FSDK.GetAllNames(tracker, IDs[i], out string name, 65536); // maximum of 65536 characters

                    if (FSDK.FSDKE_OK == res && name.Length > 0)
                    {
                        // draw name
                        StringFormat format = new StringFormat();
                        format.Alignment = StringAlignment.Center;

                        gr.DrawString(name, new Font("Arial", 16),
                                      new System.Drawing.SolidBrush(Color.LightGreen),
                                      facePosition.xc, top + w + 5, format);
                    }

                    Pen pen = Pens.LightGreen;
                    if (mouseX >= left && mouseX <= left + w && mouseY >= top && mouseY <= top + w)
                    {
                        pen = Pens.Blue;
                        if (ProgramState.psRemember == programState)
                        {
                            if (FSDK.FSDKE_OK == FSDK.LockID(tracker, IDs[i]))
                            {
                                // get the user name
                                InputName inputName = new InputName();
                                if (DialogResult.OK == inputName.ShowDialog())
                                {
                                    userName = inputName.userName;
                                    if (userName == null || userName.Length <= 0)
                                    {
                                        string s = "";
                                        FSDK.SetName(tracker, IDs[i], "");
                                        FSDK.PurgeID(tracker, IDs[i]);
                                    }
                                    else
                                    {
                                        FSDK.SetName(tracker, IDs[i], userName);
                                    }
                                    FSDK.UnlockID(tracker, IDs[i]);
                                }
                            }
                        }
                    }
                    gr.DrawRectangle(pen, left, top, w, w);
                }

                programState = ProgramState.psRecognize;

                // display current frame
                pictureBox1.Image = frameImage;
                GC.Collect(); // collect the garbage after the deletion
            }
            FSDK.SaveTrackerMemoryToFile(tracker, TrackerMemoryFile);
            FSDK.FreeTracker(tracker);

            FSDKCam.CloseVideoCamera(cameraHandle);
            FSDKCam.FinalizeCapturing();
        }
Exemplo n.º 27
0
 void OnApplicationQuit()
 {
     s_Instance = null;
 }
Exemplo n.º 28
0
 void Start()
 {
     ChName       = GameObject.Find("InputName").GetComponent <InputName>();
     genderchoose = GameObject.Find("Canvas").GetComponent <GenderChoose>();
 }
Exemplo n.º 29
0
 public void SetInputHandlingScroller(IScroller scroller, InputName inputName)
 {
     thisInputHandlingScroller = scroller;
     thisInputName             = inputName;
 }
Exemplo n.º 30
0
 public void SetText(string text)
 {
     InputName.Text = text;
     InputName.Focus();
     InputName.SelectionStart = InputName.Text.Length;
 }