private async void Animation3() //冒气泡的动画,用于回答何时收集的问题之后
        {
            Bubble.Visibility = Visibility.Visible;
            BubbleUp.Begin();
            await Task.Delay(3000);

            QuestionArea.InitWithQuestion();
        }
Example #2
0
        public async Task ShowAnswer()
        {
            ShowingMode = QuestionPageShowingMode.ShowingAnswer;
            await QuestionArea.HideUsingLinearAnimationAsync(250);

            ResultMessage = Evaluate().Message;
            await AnswerArea.ShowUsingLinearAnimationAsync(250);
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            QuestionArea questionarea = await db.QuestionAreas.FindAsync(id);

            db.QuestionAreas.Remove(questionarea);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        /*
         * private void test()
         * {
         *  MessageDialog d = new MessageDialog("aha");
         *  d.ShowAsync();
         * }
         */



        private async void Animation1() //旋转试管的动画,用于回答试管问题之后
        {
            TubeAni.Begin();
            RubberAni.Begin();
            PipeAni.Begin();
            KMnO4.Visibility = Visibility.Visible;
            await Task.Delay(1000);

            TubeAni.Completed += (s, e1) => QuestionArea.InitWithQuestion();
        }
        private async void Animation2() //移动瓶子的动画,用于回答预热的问题之后
        {
            Flame.Visibility = Visibility.Visible;
            await Task.Delay(2000);

            JarAni.Begin();
            WaterAni.Begin();
            await Task.Delay(2000);

            WaterAni.Completed += (s, e1) => QuestionArea.InitWithQuestion();
        }
        public async Task <ActionResult> Edit([Bind(Include = "QuestionAreaID,QuestionAreaName")] QuestionArea questionarea)
        {
            if (ModelState.IsValid)
            {
                db.Entry(questionarea).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(questionarea));
        }
        public async Task <ActionResult> Create([Bind(Include = "QuestionAreaID,QuestionAreaName")] QuestionArea questionarea)
        {
            if (ModelState.IsValid)
            {
                db.QuestionAreas.Add(questionarea);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(questionarea));
        }
        // GET: /QuestionArea/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            QuestionArea questionarea = await db.QuestionAreas.FindAsync(id);

            if (questionarea == null)
            {
                return(HttpNotFound());
            }
            return(View(questionarea));
        }
        private void Image_PointerReleased(object sender, PointerRoutedEventArgs e) //放开左键的事件,假如对,显示相应器材;假如错,提示
        {
            Image  i   = sender as Image;
            double top = (double)i.GetValue(Canvas.TopProperty);

            if (top < 150)  //未拖到区域
            {
                (sender as Image).SetValue(Canvas.LeftProperty, originX);
                (sender as Image).SetValue(Canvas.TopProperty, originY);
                return;
            }
            else
            {
                if ((String)i.Tag == "0")           //错误器材
                {
                    i.Visibility = Visibility.Collapsed;
                    TB001.Text   = "Wrong! -5";
                    QuestionArea.decreasePoint(5);
                    return;
                }
                else                //正确器材
                {
                    i.Visibility = Visibility.Collapsed;
                    TB001.Text   = "Correct!";
                    switch (i.Tag)
                    {
                    case "1":
                        Alcohol.Visibility       = Visibility.Visible;
                        AlcoholBurner.Visibility = Visibility.Visible;
                        break;

                    case "2":
                        Sink.Visibility   = Visibility.Visible;
                        Water0.Visibility = Visibility.Visible;
                        break;

                    case "3":
                        Pipe.Visibility = Visibility.Visible;
                        break;

                    case "4":
                        Tube.Visibility = Visibility.Visible;
                        break;

                    case "5":
                        Rubber.Visibility = Visibility.Visible;
                        break;

                    case "6":
                        Jar.Visibility   = Visibility.Visible;
                        Water.Visibility = Visibility.Visible;
                        break;

                    case "7":
                        KMnO4.Visibility = Visibility.Visible;
                        break;
                    }
                    next++;
                }
            }
        }
        private async void showFinal()
        {
            await Task.Delay(2000);

            MessageDialog d = new MessageDialog("你的分数是" + Convert.ToString(QuestionArea.allpoints) + "\n" + QuestionArea.getChoiceRecord());
            await d.ShowAsync();

            QuestionArea.Visibility = Visibility.Collapsed;
            ExpArea.Visibility      = Visibility.Collapsed;
            Title.Visibility        = Visibility.Visible;
            StartExp.Content        = "已完成!";
            StartExp.IsEnabled      = false;
            StorageFolder folder;

            folder = ApplicationData.Current.LocalFolder;
            Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            Windows.Storage.StorageFile   sampleFile    = await storageFolder.CreateFileAsync("record-exp001.txt", Windows.Storage.CreationCollisionOption.ReplaceExisting);

            await FileIO.WriteTextAsync(sampleFile, "你的分数是" + Convert.ToString(QuestionArea.allpoints) + "\n" + QuestionArea.getChoiceRecord());
        }
Example #11
0
        /// <summary>
        /// add QuestionClasifications and Save
        /// </summary>
        /// <param name="QuestionClasifications"></param>
        /// <param name="NTUser"></param>
        /// <returns></returns>
        internal async static Task <int> AddSaveAsync(QuestionClasifications QuestionClasifications, WindowsPrincipal NTUser)
        {
            int Count = 0;

            try
            {
                string TableName = QuestionClasifications.TableName;
                if (TableName == null)
                {
                    return(-1);
                }
                else if (TableName == typeof(Characteristic).Name)
                {
                    using (IQuestionCharacteristicRepository db = new QuestionCharacteristicRepository())
                    {
                        var Question = new QuestionCharacteristic()
                        {
                            QuestionID       = QuestionClasifications.QuestionID,
                            CharacteristicID = QuestionClasifications.ParameterID,
                            AdminValue       = QuestionClasifications.AdminValue,
                            Comments         = QuestionClasifications.Comments
                        };
                        db.Add(Question);
                        Count += await db.SaveAsync(NTUser);

                        QuestionClasifications.RecordID = Question.QuestionCharacteristicID;
                    }
                }
                else if (TableName == typeof(FamilyProduct).Name)
                {
                    using (IQuestionFamilyProductRepository db = new QuestionFamilyProductRepository())
                    {
                        var Question = new QuestionFamilyProduct()
                        {
                            QuestionID      = QuestionClasifications.QuestionID,
                            FamilyProductID = QuestionClasifications.ParameterID,
                            AdminValue      = QuestionClasifications.AdminValue,
                            Comments        = QuestionClasifications.Comments
                        };
                        db.Add(Question);
                        Count += await db.SaveAsync(NTUser);

                        QuestionClasifications.RecordID = Question.QuestionFamilyProductID;
                    }
                }
                else if (TableName == typeof(Product).Name)
                {
                    using (IQuestionProductRepository db = new QuestionProductRepository())
                    {
                        var Question = new QuestionProduct()
                        {
                            QuestionID = QuestionClasifications.QuestionID,
                            ProductID  = QuestionClasifications.ParameterID,
                            AdminValue = QuestionClasifications.AdminValue,
                            Comments   = QuestionClasifications.Comments
                        };
                        db.Add(Question);
                        Count += await db.SaveAsync(NTUser);

                        QuestionClasifications.RecordID = Question.QuestionProductID;
                    }
                }
                else if (TableName == typeof(Stakeholder).Name)
                {
                    using (IQuestionStakeholderRepository db = new QuestionStakeholderRepository())
                    {
                        var Question = new QuestionStakeholder()
                        {
                            QuestionID    = QuestionClasifications.QuestionID,
                            StakeholderID = QuestionClasifications.ParameterID,
                            AdminValue    = QuestionClasifications.AdminValue,
                            Comments      = QuestionClasifications.Comments
                        };
                        db.Add(Question);
                        Count += await db.SaveAsync(NTUser);

                        QuestionClasifications.RecordID = Question.QuestionStakeholderID;
                    }
                }
                else if (TableName == typeof(Area).Name)
                {
                    using (IQuestionAreaRepository db = new QuestionAreaRepository())
                    {
                        var Question = new QuestionArea()
                        {
                            QuestionID = QuestionClasifications.QuestionID,
                            AreaID     = QuestionClasifications.ParameterID,
                            AdminValue = QuestionClasifications.AdminValue,
                            Comments   = QuestionClasifications.Comments
                        };
                        db.Add(Question);
                        Count += await db.SaveAsync(NTUser);

                        QuestionClasifications.RecordID = Question.QuestionAreaID;
                    }
                }
            }
            catch (Exception ex)
            {
                Errors.Write(ex);
                Count = -1;
            }

            return(Count);
        }