예제 #1
0
        public bool Equals(PollResult input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AnswerText == input.AnswerText ||
                     (AnswerText != null && AnswerText.Equals(input.AnswerText))
                     ) &&
                 (
                     AnswerSlot == input.AnswerSlot ||
                     (AnswerSlot.Equals(input.AnswerSlot))
                 ) &&
                 (
                     LastVoteDate == input.LastVoteDate ||
                     (LastVoteDate != null && LastVoteDate.Equals(input.LastVoteDate))
                 ) &&
                 (
                     Votes == input.Votes ||
                     (Votes.Equals(input.Votes))
                 ) &&
                 (
                     RequestingUserVoted == input.RequestingUserVoted ||
                     (RequestingUserVoted != null && RequestingUserVoted.Equals(input.RequestingUserVoted))
                 ));
        }
예제 #2
0
        void StartGame()
        {
            GameSettings.IsEnabled = false;
            OnPlay.IsEnabled       = true;
            if (difficulty <= 10)
            {
                LetsPlayButton.Content = "Прекратить";
            }
            else if (difficulty <= 30)
            {
                LetsPlayButton.Content = "Сложновато, другие настройки!";
            }
            else if (difficulty <= 100)
            {
                LetsPlayButton.Content = "Я не Ванга, перенастроить";
            }
            else if (difficulty <= 1000)
            {
                LetsPlayButton.Content = "Остановить это безумие";
                StatusBar.Text         = "Если вы сможете победить, считайте что вы прошли эту игру!";
            }

            step = 0;

            AnswerText.Focus();
        }
예제 #3
0
 protected virtual void Awake()
 {
     answerPicExample  = Resources.Load <AnswerPic>("Prefabs/AnswerPic");
     answerTextExample = Resources.Load <AnswerText>("Prefabs/AnswerText");
     platform          = FindObjectOfType <PlatformController>();
     answerAnchor      = GameObject.Find("Answers").transform;
     question          = UIController.GetMenu <GameMenu>().question;
 }
예제 #4
0
 // Start is called before the first frame update
 void Start()
 {
     Score        = 0;
     hantei_maru  = GameObject.Find("hantei_maru");
     hantei_batsu = GameObject.Find("hantei_batsu");
     hantei_maru.SetActive(false);
     hantei_batsu.SetActive(false);
     MQ = GameObject.Find("QuizText").GetComponent <MultiQuestion>();
     AT = GameObject.Find("AnswerText").GetComponent <AnswerText>();
 }
예제 #5
0
파일: Form1.cs 프로젝트: Sag05/Traning-App
 private void button1_Click(object sender, EventArgs e)
 {
     Nextb.Visible      = false;
     CRA.Visible        = false;
     CRICR.Visible      = false;
     AnswerText.Enabled = true;
     AnswerText.ResetText();
     CA.Visible    = false;
     Check.Visible = true;
     LoadNext();
 }
예제 #6
0
파일: Chequer.cs 프로젝트: ashlam/PixelLove
    IEnumerator DelayShowAnswerText(float delayTime)
    {
        yield return(new WaitForSeconds(delayTime));

        AnswerText answerText = transOfAnswerText.GetComponentInChildren <AnswerText>();

        if (null != answerText)
        {
            //answerText.StartDisplayAnswerText(this.LevelName);
            string myLevelName = MainGame.currentLevelData == null ? this.LevelName : MainGame.currentLevelData.levelName;
            answerText.StartDisplayAnswerText(myLevelName);
        }
    }
        // The user first enters their submission. It is determined whether this submission matches
        // the supplied answer.
        private void QuizLogic()
        {
            if (Submission == AnswerText.ToString())
            {
                SubmitButtonColour = Color.Green;
                SubmitButtonText   = "Correct! Tap to Proceed";
                _correctSubmissions++;
            }
            else
            {
                SubmitButtonColour = Color.Red;
                SubmitButtonText   = "Incorrect! Tap to Proceed";
            }

            HasSubmitted = true;
        }
        public PlateHasBingoViewModel(int plateNum, int[,] chosenPlate, List <List <int> > missingNumbersInRows, bool hasBingo)
        {
            MissingNumbersInRows = missingNumbersInRows;

            //determine if bingo or np
            if (hasBingo)
            {
                DisplayName = "Plade nr. " + plateNum + " har BANKO!";
                AnswerText  = "Pladen har BANKO!";
                Brush       = _bingo;
            }
            else
            {
                DisplayName = "Plade nr. " + plateNum + " har ikke banko.";
                AnswerText  = "Pladen har ikke banko. Der mangler nedenstående numre:\n ";
                int i = 1;
                foreach (var missingNumbers in MissingNumbersInRows)
                {
                    AnswerText = AnswerText + "Række " + i + ":";
                    foreach (var number in missingNumbers)
                    {
                        if (AnswerText.Contains(":"))
                        {
                            if (number != 0)
                            {
                                AnswerText = AnswerText + " " + number;
                            }
                        }
                    }
                    i++;
                    AnswerText = AnswerText + "\n";
                }
                if (chosenPlate[0, 0] == -1)
                {
                    AnswerText =
                        "Pladen har ikke banko, da det er en ugyldig/frafiltreret plade.\n Ydermere, hvis der findes en person med dette pladenummer, er der noget seriøst galt.";
                }
                Brush = _noBingo;
            }
        }
예제 #9
0
        public void RegistHotKey()
        {
            HotKeyRegister.UnRegistAllKeys();

            var preferences = PreferencesService.GetPreferences();

            HotKeyRegister.RegistKey(preferences.ShowHideShortcut.ModifierKeys, preferences.ShowHideShortcut.Key, (_, __) =>
            {
                if (Visibility == Visibility.Collapsed)
                {
                    Visibility = Visibility.Visible;
                    AnswerText.Focus();
                    return;
                }

                if (Visibility == Visibility.Visible)
                {
                    Visibility = Visibility.Collapsed;
                    return;
                }
            });
        }
예제 #10
0
    //	// Update is called once per frame
    //	void Update () {
    //
    //	}


    void LoadChequer()
    {
        LevelInfo info = MainGame.currentLevelData;

        if (null != info.mainChequerObject && null != info.uiRoot)
        {
            GameObject clonedObject = GameObject.Instantiate(info.mainChequerObject) as GameObject;
            clonedObject.transform.position = Vector2.zero;


            GameObject clonedUIRoot = GameObject.Instantiate(info.uiRoot) as GameObject;
            clonedUIRoot.transform.position = Vector2.zero;

            AnswerText answerText = clonedUIRoot.GetComponentInChildren <AnswerText>();
            Chequer    chequer    = clonedObject.GetComponentInChildren <Chequer>();
            if (answerText != null)
            {
                chequer.transOfAnswerText = answerText.transform.parent;
            }
        }
        Camera.main.orthographicSize = info.mainCameraSize;
    }
        private async Task AddOrUpdateTextAnswer(int eventId, Dictionary <int, AnswerText> answerTexts, QuestionTextModel question, string answer)
        {
            if (!answerTexts.ContainsKey(question.Id))
            {
                var answerText = new AnswerText
                {
                    QuestionId       = question.Id,
                    EventId          = eventId,
                    AnswerTextAnswer = answer
                };

                _context.Add(answerText);
                await _context.SaveChangesAsync();
            }
            else
            {
                var answerText = answerTexts[question.Id];
                answerText.AnswerTextAnswer = answer;
                _context.Update(answerText);
                await _context.SaveChangesAsync();
            }
        }
예제 #12
0
        private void InitializeCommands()
        {
            GoToProfileCommand = new RelayCommand <TappedRoutedEventArgs>(args =>
            {
                LastClickedProfilePic = args.OriginalSource as Ellipse;
                var parentGrid        = LastClickedProfilePic.Parent as Grid;
                LastClickedUsername   = parentGrid.FindName("lblAnswerUsername") as TextBlock;
                var dc = LastClickedProfilePic.DataContext as HNAnswer;
                App.ViewModelLocator.Profile.LoadUser((int)dc.user.id);
                App.ViewModelLocator.Profile.ProfilePicture = dc.user.profile_image;
                App.ViewModelLocator.Profile.UserName       = dc.user.name;
                if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.Animation.ConnectedAnimationService"))
                {
                    ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ProfilePicture", LastClickedProfilePic);
                    ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("Username", LastClickedUsername);
                }
                _navigationService.NavigateTo(typeof(ProfilePage));
            });

            GoToOPProfileCommand = new RelayCommand <TappedRoutedEventArgs>(args =>
            {
                LastClickedProfilePic = args.OriginalSource as Ellipse;
                var parentGrid        = (LastClickedProfilePic.Parent as Border).Parent as Grid;
                LastClickedUsername   = parentGrid.FindName("lblUsername") as TextBlock;
                App.ViewModelLocator.Profile.LoadUser((int)CurrentQuestion.user.id);
                App.ViewModelLocator.Profile.ProfilePicture = CurrentQuestion.user.profile_image;
                App.ViewModelLocator.Profile.UserName       = CurrentQuestion.user.name;
                if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.Animation.ConnectedAnimationService"))
                {
                    ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ProfilePicture", LastClickedProfilePic);
                    ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("Username", LastClickedUsername);
                }
                _navigationService.NavigateTo(typeof(ProfilePage));
            });

            ReplyCommand = new RelayCommand <HNAnswer>(args =>
            {
                var atTag = string.Format("@{0} ", args.user.name);

                if (string.IsNullOrWhiteSpace(AnswerText))
                {
                    AnswerText = atTag;
                }
                else if (!AnswerText.Contains(atTag))
                {
                    AnswerText = AnswerText + " " + atTag;
                }
            });

            SubmitAnswerCommand = new RelayCommand(async() =>
            {
                if (!string.IsNullOrWhiteSpace(AnswerText))
                {
                    CanSendAnswer = false;
                    InCall        = true;

                    HNAnswerResult answer = new HNAnswerResult
                    {
                        answer = new HNAnswer
                        {
                            content = AnswerText,
                            quick   = false
                        }
                    };

                    #region Attachments
                    if (UploadImages.Count > 0)
                    {
                        try
                        {
                            var file     = await StorageFile.GetFileFromPathAsync(UploadImages[0].UriSource.AbsolutePath);
                            var response = await DataService.UploadAttachment(file, true, false);
                            answer.image = new HNImage {
                                id = response.image.id
                            };
                        }
                        catch (Exception)
                        {
                            await new MessageDialog("We're having trouble uploading that attachment").ShowAsync();
                            LoggerService.LogEvent("Attachment_upload_failed");
                        }
                    }
                    #endregion

                    try
                    {
                        HNAnswerResult result = await DataService.PostAnswer(answer.answer, (int)CurrentQuestion.id);
                        LoggerService.LogEvent("Answer_posted");
                        UploadImages.Clear();
                        AnswerText = "";
                        Answers.Add(result.answer);
                        InCall        = false;
                        CanSendAnswer = true;
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message);
                        LoggerService.LogEvent("Posting_answer_failed");
                    }
                }
                else
                {
                    await new MessageDialog("The answer box is empty").ShowAsync();
                }
            });

            SelectOption = new RelayCommand <ItemClickEventArgs>(args =>
            {
                var lst = args.OriginalSource as ListView;
                int i   = lst.IndexFromContainer(args.ClickedItem as Grid);
            });

            #region Attachments

            SelectPhotoCommand = new RelayCommand(async() =>
            {
                var picker      = new FileOpenPicker();
                picker.ViewMode = PickerViewMode.Thumbnail;
                picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                picker.FileTypeFilter.Add(".jpg");
                picker.FileTypeFilter.Add(".jpeg");
                picker.FileTypeFilter.Add(".png");

                var imageFile = await picker.PickSingleFileAsync();
                if (imageFile != null)
                {
                    // Application now has read/write access to the picked file
                    Debug.WriteLine("Picked photo: " + imageFile.Name);
                    var uploadImage = new BitmapImage();
                    FileRandomAccessStream stream = (FileRandomAccessStream)await imageFile.OpenAsync(FileAccessMode.Read);
                    uploadImage.SetSource(stream);
                    UploadImages.Add(uploadImage);
                }
                else
                {
                    Debug.WriteLine("Operation cancelled.");
                }
            });
            TakePhotoCommand = new RelayCommand(async() =>
            {
                CameraCaptureUI captureUI      = new CameraCaptureUI();
                captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;

                var imageFile = await captureUI.CaptureFileAsync(CameraCaptureUIMode.Photo);

                if (imageFile == null)
                {
                    return;
                }

                IRandomAccessStream stream = await imageFile.OpenAsync(FileAccessMode.Read);

                BitmapImage image = new BitmapImage();
                await image.SetSourceAsync(stream);
                UploadImages.Clear();
                UploadImages.Add(image);
            });
            RecordAudioCommand = new RelayCommand(() =>
            {
            });
            #endregion
        }
예제 #13
0
        public async Task <IActionResult> DownloadExcel(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var userEvent = await _context.UserEventModels.FirstOrDefaultAsync(model => model.EventId == id);

            if (userEvent == null)
            {
                return(NotFound());
            }

            var eventInfo = await _context.EventInfoModel.FirstOrDefaultAsync(m => m.Id == userEvent.EventId);

            if (eventInfo == null)
            {
                return(NotFound());
            }

            var user = await _userManager.FindByIdAsync(userEvent.UserId);

            if (user == null)
            {
                return(NotFound());
            }

            var userEventDetails = new UserEventDetailsViewModel()
            {
                EmployeeName   = user.EmployeeName,
                Department     = user.Department,
                Position       = user.Position,
                EventId        = eventInfo.Id,
                EventName      = eventInfo.EventName,
                EventOrg       = eventInfo.EventOrg,
                PresentersName = eventInfo.PresentersName,
                EventLocation  = eventInfo.EventLocation,
                EventStartDate = eventInfo.EventStartDate,
                EventEndDate   = eventInfo.EventEndDate
            };

            //string fileName = "Event Feedback Form.xlsx";
            //string sourcePath = @"D:\Core\FeedbackService\FeedbackWebsite\FeedbackWebsite\Excel\Source";

            string fileName = @"Excel\Source\Event Feedback Form.xlsx";

            var exePath = Path.GetDirectoryName(System.Reflection
                                                .Assembly.GetExecutingAssembly().CodeBase);
            Regex appPathMatcher = new Regex(@"(?<!fil)[A-Za-z]:\\+[\S\s]*?(?=\\+bin)");
            var   appRoot        = appPathMatcher.Match(exePath).Value;

            //string soutceFile = Path.Combine(sourcePath, fileName);
            string soutceFile = Path.Combine(appRoot, fileName);

            MemoryStream ms;

            using (var fs = new FileStream(soutceFile, FileMode.Open, FileAccess.Read))
            {
                ms = new MemoryStream();
                fs.CopyTo(ms);
                ms.Position = 0;
            }


            UpdateCell(ms, userEventDetails.EmployeeName, 4, "B");

            string buf = $"{userEventDetails.Department} \\ {userEventDetails.Position}";

            UpdateCell(ms, buf, 5, "B");

            UpdateCell(ms, userEventDetails.EventName, 6, "B");

            UpdateCell(ms, userEventDetails.EventOrg, 7, "B");

            UpdateCell(ms, userEventDetails.PresentersName, 8, "B");

            UpdateCell(ms, userEventDetails.EventLocation, 9, "B");

            UpdateCell(ms, userEventDetails.EventStartDate.Day, 10, "B");
            UpdateCell(ms, userEventDetails.EventStartDate.Month, 10, "C");
            UpdateCell(ms, userEventDetails.EventStartDate.Year, 10, "D");

            UpdateCell(ms, userEventDetails.EventEndDate.Day, 11, "B");
            UpdateCell(ms, userEventDetails.EventEndDate.Month, 11, "C");
            UpdateCell(ms, userEventDetails.EventEndDate.Year, 11, "D");

            var answersInfoEnums = _context.AnswerEnum.Where(model => model.EventId == id);

            uint counter = 14;

            foreach (var answersInfoEnum in answersInfoEnums)
            {
                buf = ReturnStringAnswer(answersInfoEnum.QuestionEnumAnswer);
                UpdateCell(ms, buf, counter, "E");
                counter++;
            }

            AnswerText answerText = await _context.AnswerText.FirstOrDefaultAsync(model => model.EventId == id);

            UpdateCell(ms, answerText.AnswerTextAnswer, 25, "A");
            ms.Position = 0;


            string downloadFileName = $"{userEventDetails.EmployeeName} - {userEventDetails.EventName} - {fileName}";

            return(File(ms, "application/xlsx", downloadFileName));
            //return RedirectToAction("Index");
        }
예제 #14
0
 public override bool Equals(Object obj)
 {
     if (obj is Problem ob)
     {
         return(Id.Equals(ob.Id) && CategoryId.Equals(ob.CategoryId) && ThemeId.Equals(ob.ThemeId) && Adress.Equals(ob.Adress) &&
                SourceId.Equals(ob.SourceId) && CreateDate.Equals(ob.CreateDate) && AnswerDate.Equals(ob.AnswerDate) &&
                ProblemText.Equals(ob.ProblemText) && ProblemPhotos.Equals(ob.ProblemPhotos) && AnswerText.Equals(ob.AnswerText) &&
                AnswerPhotos.Equals(ob.AnswerPhotos) && StatusId.Equals(ob.StatusId) && DistrictId.Equals(ob.DistrictId) && ChildID.Equals(ob.ChildID) &&
                ParentID.Equals(ob.ParentID) && IspolnitelName.Equals(ob.IspolnitelName) && IspolnitelId.Equals(ob.IspolnitelId));
     }
     return(false);
 }
예제 #15
0
 private void Window_ContentRendered(object sender, EventArgs e)
 {
     RegistHotKey();
     AnswerText.Focus();
 }
예제 #16
0
 private void SwichMode_Click(object sender, RoutedEventArgs e)
 {
     AnswerText.Focus();
 }
예제 #17
0
 public override string ToString()
 {
     return($"{LinkedID} :: {AnswerText.NormalizeLength(20)}");
 }