コード例 #1
0
        public void ChangeSlide(string nameSlider)
        {
            AudioManager audioManager = SingletonPool.Get <AudioManager>();
            AudioEnum    audioEnum    = EnumExtend.ParseEnum <AudioEnum>(nameSlider);

            audioManager.SetVolume(audioEnum, sliders[audioEnum].value, true);
        }
コード例 #2
0
ファイル: UserInfoOp.cs プロジェクト: wangzhkai/sunmvc
        public IEnumerable <KeyValue> GetUserStatus()
        {
            var edata = EnumExtend <UserStatus> .GetEnumKeyName();

            return(edata.Select(o => new KeyValue {
                key = o.Key.ToString(), value = o.Value
            }));
        }
コード例 #3
0
        private static LayerFocus ChangeLayer(int index)
        {
            index = Mathf.Clamp(index, 0, EnumExtend.Length <LayerFocus>() - 1);

            _currentLayerFocus = (LayerFocus)index;
            OnChangeLayer?.Invoke(_currentLayerFocus);
            return(_currentLayerFocus);
        }
コード例 #4
0
        private void Simpleanswerbutton_Click(object sender, RibbonControlEventArgs e)
        {
            //Microsoft.Office.Interop.PowerPoint.Slides slides = null;//PPT中所有的幻灯片
            Microsoft.Office.Interop.PowerPoint.Presentation MyPres = Globals.ThisAddIn.Application.ActivePresentation;                                                                    // 当前ppt应用实例
            //slides = Globals.ThisAddIn.Application.ActivePresentation.Slides;//获取当前PPT中的所有幻灯片
            Microsoft.Office.Interop.PowerPoint.Slide MySlide = Globals.ThisAddIn.Application.ActiveWindow.View.Slide;                                                                     //获取当前选中的幻灯片
            Microsoft.Office.Interop.PowerPoint.Slide NewSimpleQuestionSlide = MyPres.Slides.Add(MySlide.SlideIndex + 1, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutBlank); //插入新的幻灯片

            #region 插入简答题题目类型
            Microsoft.Office.Interop.PowerPoint.TextRange SATextRng = null;

            NewSimpleQuestionSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 21.5F, 40F, 100F, 30F).Name = "SimpleAnswerQuestion";
            NewSimpleQuestionSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name            = "questionType";
            NewSimpleQuestionSlide.Shapes["questionType"].TextFrame.TextRange.Text = "4";
            NewSimpleQuestionSlide.Shapes["questionType"].Visible = MsoTriState.msoFalse;

            NewSimpleQuestionSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionScore";
            NewSimpleQuestionSlide.Shapes["questionScore"].TextFrame.TextRange.Text = "0";
            NewSimpleQuestionSlide.Shapes["questionScore"].Visible = MsoTriState.msoFalse;
            NewSimpleQuestionSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionLimitTime";
            NewSimpleQuestionSlide.Shapes["questionLimitTime"].TextFrame.TextRange.Text = "0";
            NewSimpleQuestionSlide.Shapes["questionLimitTime"].Visible = MsoTriState.msoFalse;
            NewSimpleQuestionSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionAnswer";
            NewSimpleQuestionSlide.Shapes["questionAnswer"].TextFrame.TextRange.Text = "0";
            NewSimpleQuestionSlide.Shapes["questionAnswer"].Visible = MsoTriState.msoFalse;

            SATextRng = NewSimpleQuestionSlide.Shapes[1].TextFrame.TextRange;                                           //请注意此处Shapes的索引,由于文本框是第一个添加的Shapes,所以此处索引是1。

            SATextRng.Font.NameFarEast          = "微软雅黑";                                                               //文本框中,中文的字体
            SATextRng.Font.NameAscii            = "Calibri";                                                            //文本框中,英文和数字的字体
            SATextRng.Text                      = "简答题";                                                                //显示的内容
            SATextRng.Font.Bold                 = MsoTriState.msoTrue;                                                  //是否加粗
            SATextRng.Font.Color.RGB            = 1 + 1 * 256 + 1 * 256 * 256;                                          //字体颜色,其中ABC直接用自定义颜色中的数字代替即可。
            SATextRng.Font.Size                 = 24;                                                                   //字体大小是24.
            SATextRng.ParagraphFormat.Alignment = Microsoft.Office.Interop.PowerPoint.PpParagraphAlignment.ppAlignLeft; //文本对齐方式(水平方向)
            NewSimpleQuestionSlide.Shapes[1].TextFrame.VerticalAnchor = MsoVerticalAnchor.msoAnchorMiddle;              //文本对齐方式(垂直方向)
            #endregion

            #region 插入简答题题目
            Microsoft.Office.Interop.PowerPoint.TextRange SQTextRng = null;

            NewSimpleQuestionSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 21.5F, 150F, 777F, 300F).Name = "questionDescribe";
            SQTextRng = NewSimpleQuestionSlide.Shapes["questionDescribe"].TextFrame.TextRange;;                         //请注意此处Shapes的索引,由于文本框是第二个添加的Shapes,所以此处索引是2。

            SQTextRng.Font.NameFarEast          = "微软雅黑";                                                               //文本框中,中文的字体
            SQTextRng.Font.NameAscii            = "Calibri";                                                            //文本框中,英文和数字的字体
            SQTextRng.Text                      = "请编写题干";                                                              //显示的内容
            SQTextRng.Font.Bold                 = MsoTriState.msoFalse;                                                 //是否加粗
            SQTextRng.Font.Color.RGB            = 1 + 1 * 256 + 1 * 256 * 256;                                          //字体颜色,其中ABC直接用自定义颜色中的数字代替即可。
            SQTextRng.Font.Size                 = 24;                                                                   //字体大小是24.
            SQTextRng.ParagraphFormat.Alignment = Microsoft.Office.Interop.PowerPoint.PpParagraphAlignment.ppAlignLeft; //文本对齐方式(水平方向)
            NewSimpleQuestionSlide.Shapes[2].TextFrame.VerticalAnchor = MsoVerticalAnchor.msoAnchorMiddle;              //文本对齐方式(垂直方向)
            #endregion

            AddSubmitOleForm(NewSimpleQuestionSlide, 822F, 466F, 89F, 46F, EnumExtend.GetDisplayText(ButtonNameEnum.SUMBIT), "sumbitButton"); //插入发布按钮
            AddSubmitOleForm(NewSimpleQuestionSlide, 727F, 466F, 80F, 46F, EnumExtend.GetDisplayText(ButtonNameEnum.GETANS), "answerButton"); //插入答案按钮
            NewSimpleQuestionSlide.Select();
        }
コード例 #5
0
        /// <summary>
        /// 获取配置类型用于combox
        /// </summary>
        /// <returns>json数据</returns>
        public JsonResult GetOpTypeCombox()
        {
            var edata = EnumExtend <ConfElementType> .GetEnumKeyName();

            IEnumerable <KeyValue> data = edata.Select(o => new KeyValue {
                key = o.Key.ToString(), value = o.Value
            });

            return(Json(data));
        }
コード例 #6
0
        private static void CreateDictonary()
        {
            dictionaryEvent = new Dictionary <EventAction, Delegate>();
            int lenght = EnumExtend.Length <EventAction>();

            for (int i = 0; i < lenght; i++)
            {
                dictionaryEvent.Add((EventAction)i, null);
            }
        }
コード例 #7
0
        private void CreateDictonary()
        {
            int lenght = EnumExtend.Length <AudioEnum>();

            for (int i = 0; i < lenght; i++)
            {
                string stringVolume = ((AudioEnum)i).ToString();
                stringVolume = Char.ToLowerInvariant(stringVolume[0]) + stringVolume.Substring(1) + "Volume";
                containers.Add((AudioEnum)i, new AudioContainer(stringVolume));
            }
        }
コード例 #8
0
ファイル: PatrolTask.cs プロジェクト: FeboGameDeveloper/Pearl
        protected override void OnExecute()
        {
            edgeSquare = EnumExtend.GetRandom <RectangleEdge>(edgeSquare);

            BoxCollider2D collider = collider2D.value;

            Vector2 newPosition = collider.GetPerimeterPoint(edgeSquare, Random.value);

            targetTransform.value.position = newPosition;

            EndAction();
        }
コード例 #9
0
        /// <summary>
        /// 修改密码按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void updateUserButton_Click(object sender, EventArgs e)
        {
            lockButton();
            string oldPassword = oldPasswordBox.Text.Trim();
            string newPassword = newPasswordBox.Text.Trim();

            //输入密码格式错误
            if (!UserUitls.IsOkPassword(oldPassword) || !UserUitls.IsOkPassword(newPassword))
            {
                addAlter(EnumExtend.GetDisplayText(LoginEnum.ERRORPWD), CxFlatAlertBox.AlertType.Error);
                unlockButton();
            }

            //发送HTTP请求访问服务器
            try
            {
                User user = new User();
                user.username = LoginInfo.CurrentUser.data.user.username;
                user.password = oldPassword;
                UpdateUserData updateUserData = new UpdateUserData();
                updateUserData.user        = user;
                updateUserData.newPassword = newPassword;

                SessionData <UpdateUserData> sessionData = new SessionData <UpdateUserData>();
                sessionData.sessionId = LoginInfo.CurrentUser.sessionId;
                sessionData.data      = updateUserData;
                string             url       = Resources.Server + Resources.UpdateUserUrl;
                string             data      = JsonConvert.SerializeObject(sessionData);
                string             response  = HttpUitls.POST(url, data);
                OkeResult <string> okeResult = JsonConvert.DeserializeObject <OkeResult <string> >(response);
                if (okeResult.success)
                {
                    addAlter(EnumExtend.GetDisplayText(LoginEnum.SUCC_UPDATE), CxFlatAlertBox.AlertType.Success);
                    timer.Stop();
                    timer.Tick += formClose_Tick;
                    timer.Start();
                }
                else
                {
                    addAlter(okeResult.error, CxFlatAlertBox.AlertType.Error);
                    unlockButton();
                }
            }
            catch (Exception)
            {
                addAlter(Resources.ExceptionTip, CxFlatAlertBox.AlertType.Error);
                unlockButton();
            }
            return;
        }
コード例 #10
0
        private void votebutton_Click(object sender, RibbonControlEventArgs e)
        {
            Presentation MyPres      = Globals.ThisAddIn.Application.ActivePresentation;
            Slide        activeSlide = (Slide)Globals.ThisAddIn.Application.ActiveWindow.View.Slide;

            int   nowIndex  = activeSlide.SlideIndex;
            Slide voteSlide = MyPres.Slides.Add(nowIndex + 1, PpSlideLayout.ppLayoutBlank);

            voteSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 21.5F, 40F, 100F, 30F).Name = "VoteQuestion";
            voteSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name            = "questionType";
            voteSlide.Shapes["questionType"].TextFrame.TextRange.Text = "5";
            voteSlide.Shapes["questionType"].Visible = MsoTriState.msoFalse;
            voteSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionLimitTime";
            voteSlide.Shapes["questionLimitTime"].TextFrame.TextRange.Text = "0";
            voteSlide.Shapes["questionLimitTime"].Visible = MsoTriState.msoFalse;
            voteSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionAnswer";
            voteSlide.Shapes["questionAnswer"].TextFrame.TextRange.Text = "A;";
            voteSlide.Shapes["questionAnswer"].Visible = MsoTriState.msoFalse;

            TextRange questionDescribe = null;

            voteSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 91F, 50F, 777F, 60F).Name = "questionDescribe";
            questionDescribe                  = voteSlide.Shapes["questionDescribe"].TextFrame.TextRange;
            questionDescribe.Text             = "此处填写投票内容";
            questionDescribe.Font.NameFarEast = "微软雅黑";
            questionDescribe.Font.NameAscii   = "Calibri";
            questionDescribe.Font.Size        = 24;
            questionDescribe.Font.Bold        = MsoTriState.msoFalse;


            Microsoft.Office.Interop.PowerPoint.TextRange VoteTextRng = null;                                             //设置第一个文本框
            VoteTextRng = voteSlide.Shapes["VoteQuestion"].TextFrame.TextRange;                                           //请注意此处Shapes的索引,由于文本框是第一个添加的Shapes,所以此处索引是1。

            VoteTextRng.Font.NameFarEast          = "微软雅黑";                                                               //文本框中,中文的字体
            VoteTextRng.Font.NameAscii            = "Calibri";                                                            //文本框中,英文和数字的字体
            VoteTextRng.Text                      = "投票";                                                                 //显示的内容
            VoteTextRng.Font.Bold                 = MsoTriState.msoTrue;                                                  //是否加粗
            VoteTextRng.Font.Color.RGB            = 1 + 1 * 256 + 1 * 256 * 256;                                          //字体颜色,其中ABC直接用自定义颜色中的数字代替即可。
            VoteTextRng.Font.Size                 = 24;                                                                   //字体大小是24.
            VoteTextRng.ParagraphFormat.Alignment = Microsoft.Office.Interop.PowerPoint.PpParagraphAlignment.ppAlignLeft; //文本对齐方式(水平方向)

            addVoteChoice(voteSlide, "A", 91F, 138F, 152F, 143F);
            addVoteChoice(voteSlide, "B", 91F, 197F, 152F, 203F);
            addVoteChoice(voteSlide, "C", 91F, 257F, 152F, 262F);
            //AddSubmitOleForm(voteSlide, 727F, 466F, 80F, 46F, EnumExtend.GetDisplayText(ButtonNameEnum.GETANS), "answerButton");
            AddSubmitOleForm(voteSlide, 822F, 466F, 80F, 46F, EnumExtend.GetDisplayText(ButtonNameEnum.SUMBIT), "sumbitButton");

            voteSlide.Select();
        }
コード例 #11
0
        private static void CreateDictonary()
        {
            int lenght = EnumExtend.Length <EventAction>();

            for (int i = 0; i < lenght; i++)
            {
                dictionaryEvent.Add((EventAction)i, null);
            }

            lenght = EnumExtend.Length <EventFastAction>();

            for (int i = 0; i < lenght; i++)
            {
                dictionaryFastEvent.Add((EventFastAction)i, null);
            }
        }
コード例 #12
0
        /// <summary>
        /// 增加多选题幻灯片事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void multipleChoice_Click(object sender, RibbonControlEventArgs e)
        {
            Presentation MyPres      = Globals.ThisAddIn.Application.ActivePresentation;
            Slide        activeSlide = (Slide)Globals.ThisAddIn.Application.ActiveWindow.View.Slide;

            int   nowIndex            = activeSlide.SlideIndex;
            Slide multipleChoiceSlide = MyPres.Slides.Add(nowIndex + 1, PpSlideLayout.ppLayoutBlank);

            //往题目中添加标记
            multipleChoiceSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionType";
            multipleChoiceSlide.Shapes["questionType"].TextFrame.TextRange.Text = "1";
            multipleChoiceSlide.Shapes["questionType"].Visible = MsoTriState.msoFalse;
            multipleChoiceSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionScore";
            multipleChoiceSlide.Shapes["questionScore"].TextFrame.TextRange.Text = "0";
            multipleChoiceSlide.Shapes["questionScore"].Visible = MsoTriState.msoFalse;
            multipleChoiceSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionLimitTime";
            multipleChoiceSlide.Shapes["questionLimitTime"].TextFrame.TextRange.Text = "0";
            multipleChoiceSlide.Shapes["questionLimitTime"].Visible = MsoTriState.msoFalse;
            multipleChoiceSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionAnswer";
            multipleChoiceSlide.Shapes["questionAnswer"].TextFrame.TextRange.Text = "A;";
            multipleChoiceSlide.Shapes["questionAnswer"].Visible = MsoTriState.msoFalse;

            multipleChoiceSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 91F, 16F, 82F, 33F).Name = "questionTypeText";
            multipleChoiceSlide.Shapes["questionTypeText"].TextFrame.TextRange.Text             = "多选题";
            multipleChoiceSlide.Shapes["questionTypeText"].TextFrame.TextRange.Font.NameFarEast = "微软雅黑";
            multipleChoiceSlide.Shapes["questionTypeText"].TextFrame.TextRange.Font.NameAscii   = "Calibri";
            multipleChoiceSlide.Shapes["questionTypeText"].TextFrame.TextRange.Font.Size        = 24;
            multipleChoiceSlide.Shapes["questionTypeText"].TextFrame.TextRange.Font.Bold        = MsoTriState.msoCTrue;

            TextRange questionDescribe = null;

            multipleChoiceSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 91F, 50F, 777F, 60F).Name = "questionDescribe";
            questionDescribe                  = multipleChoiceSlide.Shapes["questionDescribe"].TextFrame.TextRange;
            questionDescribe.Text             = "此处填写题目描述";
            questionDescribe.Font.NameFarEast = "微软雅黑";
            questionDescribe.Font.NameAscii   = "Calibri";
            questionDescribe.Font.Size        = 24;
            questionDescribe.Font.Bold        = MsoTriState.msoFalse;

            addOption(multipleChoiceSlide, "A", 91F, 138F, 152F, 143F);
            addOption(multipleChoiceSlide, "B", 91F, 197F, 152F, 203F);
            addOption(multipleChoiceSlide, "C", 91F, 257F, 152F, 262F);
            AddSubmitOleForm(multipleChoiceSlide, 727F, 466F, 80F, 46F, EnumExtend.GetDisplayText(ButtonNameEnum.GETANS), "answerButton");
            AddSubmitOleForm(multipleChoiceSlide, 822F, 466F, 80F, 46F, EnumExtend.GetDisplayText(ButtonNameEnum.SUMBIT), "sumbitButton");

            multipleChoiceSlide.Select();
        }
コード例 #13
0
        /// <summary>
        /// 更新数据按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void updateInfoButton_Click(object sender, EventArgs e)
        {
            lockButton();
            string name  = nameBox.Text.Trim();
            string title = titleBox.Text.Trim();

            //用户信息格式错误
            if (!UserUitls.IsOkInfo(name, title))
            {
                addAlter(EnumExtend.GetDisplayText(RegisterEnum.ERROR_INFO), CxFlatAlertBox.AlertType.Error);
                unlockButton();
                return;
            }

            //发送HTTP请求访问服务器
            try
            {
                SessionData <Teacher> sessionData = new SessionData <Teacher>();
                sessionData.sessionId         = LoginInfo.CurrentUser.sessionId;
                sessionData.data              = LoginInfo.CurrentUser.data;
                sessionData.data.teacherName  = name;
                sessionData.data.teacherTitle = title;
                string url      = Resources.Server + Resources.UpdateInfoUrl;
                string data     = JsonConvert.SerializeObject(sessionData);
                string response = HttpUitls.POST(url, data);
                OkeResult <SessionData <Teacher> > okeResult = JsonConvert.DeserializeObject <OkeResult <SessionData <Teacher> > >(response);
                if (okeResult.success)
                {
                    addAlter(EnumExtend.GetDisplayText(LoginEnum.SUCC_UPDATE), CxFlatAlertBox.AlertType.Success);
                    LoginInfo.CurrentUser.sessionId = okeResult.data.sessionId;
                    LoginInfo.CurrentUser.data      = okeResult.data.data;
                    timer.Stop();
                    timer.Tick += formClose_Tick;
                    timer.Start();
                }
                else
                {
                    addAlter(okeResult.error, CxFlatAlertBox.AlertType.Error);
                    unlockButton();
                }
            }
            catch (Exception)
            {
                addAlter(Resources.ExceptionTip, CxFlatAlertBox.AlertType.Error);
                unlockButton();
            }
        }
コード例 #14
0
        /// <summary>
        /// 发布按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void submitButton_Click(object sender, EventArgs e)
        {
            lockButton();

            //未登录或未开启课堂
            if (LoginInfo.CurrentUser.sessionId == null || CourseInfo.CurrentUser.classCode == null)
            {
                addAlter(EnumExtend.GetDisplayText(OperateEnum.NO_COURSE), CxFlatAlertBox.AlertType.Error);
                return;
            }
            SessionData <QuestionData> sessionData = new SessionData <QuestionData>();

            sessionData.sessionId = LoginInfo.CurrentUser.sessionId;
            sessionData.data      = questionData;
            //发送HTTP请求访问服务器
            try
            {
                string url  = Resources.Server + Resources.AddQuestionUrl;
                string data = JsonConvert.SerializeObject(sessionData);
                System.Diagnostics.Debug.WriteLine(data);//测试
                string response = HttpUitls.POST(url, data);
                OkeResult <SessionData <string> > okeResult = JsonConvert.DeserializeObject <OkeResult <SessionData <string> > >(response);
                if (okeResult.success)
                {
                    addAlter(EnumExtend.GetDisplayText(OperateEnum.OP_SUCC), CxFlatAlertBox.AlertType.Success);
                    timer.Stop();
                    questionData.question.questionId = int.Parse(okeResult.error);
                    AnswerSituationForm answerSituationForm = new AnswerSituationForm();
                    answerSituationForm.load(questionData.question);
                    answerSituationForm.ShowDialog();
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                else
                {
                    addAlter(EnumExtend.GetDisplayText(OperateEnum.OP_FAIL), CxFlatAlertBox.AlertType.Error);
                    unlockButton();
                }
            }
            catch (Exception)
            {
                addAlter(Resources.ExceptionTip, CxFlatAlertBox.AlertType.Error);
                unlockButton();
            }

            unlockButton();
        }
コード例 #15
0
ファイル: SubmitVoteForm.cs プロジェクト: ZengYingJun97/Oke
        /// <summary>
        /// 发布按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void submitButton_Click(object sender, EventArgs e)
        {
            lockButton();
            if (LoginInfo.CurrentUser.sessionId == null || CourseInfo.CurrentUser.classCode == null)
            {
                addAlter(EnumExtend.GetDisplayText(OperateEnum.NO_COURSE), CxFlatAlertBox.AlertType.Error);
                return;
            }
            SessionData <VoteData> sessionData = new SessionData <VoteData>();

            sessionData.sessionId = LoginInfo.CurrentUser.sessionId;
            sessionData.data      = voteData;
            try
            {
                string url      = Properties.Resources.Server + Properties.Resources.AddVoteUrl;
                string data     = JsonConvert.SerializeObject(sessionData);
                string response = HttpUitls.POST(url, data);
                System.Diagnostics.Debug.WriteLine(response + "触发了");
                //Vote vote = voteData.vote;
                OkeResult <SessionData <Vote> > okeResult = JsonConvert.DeserializeObject <OkeResult <SessionData <Vote> > >(response);

                if (okeResult.success)
                {
                    addAlter(EnumExtend.GetDisplayText(OperateEnum.OP_SUCC), CxFlatAlertBox.AlertType.Success);
                    timer.Stop();
                    //voteData.vote.voteId = int.Parse(okeResult.error);
                    VoteSituationForm voteSituationForm = new VoteSituationForm();
                    //voteSituationForm.voteData = voteData;
                    voteSituationForm.votecount = voteData.voteChoiceList.Count;
                    voteSituationForm.load(okeResult.data.data);
                    System.Diagnostics.Debug.WriteLine(voteData.voteChoiceList.Count + "hahaha");
                    voteSituationForm.ShowDialog();
                    timer.Tick += formClose_Tick;
                    timer.Start();
                }
            }
            catch (Exception)
            {
                addAlter(EnumExtend.GetDisplayText(OperateEnum.OP_FAIL), CxFlatAlertBox.AlertType.Error);
                unlockButton();
            }
            unlockButton();
        }
コード例 #16
0
ファイル: InfoForm.cs プロジェクト: ZengYingJun97/Oke
        /// <summary>
        /// 退出按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void logoutButton_Click(object sender, EventArgs e)
        {
            lockButton();
            SessionData <Teacher> sessionData = new SessionData <Teacher>();

            sessionData.sessionId = LoginInfo.CurrentUser.sessionId;
            sessionData.data      = LoginInfo.CurrentUser.data;

            //发送HTTP请求访问服务器
            try
            {
                string             url      = Resources.Server + Resources.LogoutUrl;
                string             data     = JsonConvert.SerializeObject(sessionData);
                string             response = HttpUitls.POST(url, data);
                OkeResult <string> result   = JsonConvert.DeserializeObject <OkeResult <string> >(response);
                if (result.success)
                {
                    addAlter(EnumExtend.GetDisplayText(LoginEnum.SUCC_LOGOUT), CxFlatAlertBox.AlertType.Success);
                    LoginInfo.CurrentUser.sessionId = null;
                    LoginInfo.CurrentUser.data      = null;
                    timer.Stop();
                    timer.Tick += formClose_Tick;
                    timer.Start();
                }
                else
                {
                    addAlter(result.error, CxFlatAlertBox.AlertType.Error);
                    unlockButton();
                }
            }
            catch
            {
                addAlter(Resources.ExceptionTip, CxFlatAlertBox.AlertType.Error);
                unlockButton();
            }
            return;
        }
コード例 #17
0
 protected override List <string> Take()
 {
     return(EnumExtend.ConvertInListString <SystemLanguage>(LocalizationManager.GetCurrentLanguages()));
 }
コード例 #18
0
 /// <summary>
 /// The method returns enumerator of actual scene, if the scene there is't, the method return null.
 /// </summary>
 private SceneEnum GetActualLevel(Scene scene)
 {
     return(EnumExtend.ParseEnum <SceneEnum>(scene.name));
 }
コード例 #19
0
        /// <summary>
        /// 登录按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void loginButton_Click(object sender, EventArgs e)
        {
            lockButton();
            bool   isSave   = rememberUser.Checked;
            string username = usernameBox.Text.Trim();
            string password = passwordBox.Text.Trim();

            //输入框不能为空
            if (username.Equals("") || password.Equals(""))
            {
                addAlter(EnumExtend.GetDisplayText(LoginEnum.NULLINPUT), CxFlatAlertBox.AlertType.Error);
                unlockButton();
                return;
            }

            //用户名格式错误
            if (!UserUitls.IsOkUsername(username))
            {
                addAlter(EnumExtend.GetDisplayText(LoginEnum.ERRORURN), CxFlatAlertBox.AlertType.Error);
                unlockButton();
                return;
            }

            //密码格式错误
            if (!UserUitls.IsOkPassword(password))
            {
                addAlter(EnumExtend.GetDisplayText(LoginEnum.ERRORPWD), CxFlatAlertBox.AlertType.Error);
                unlockButton();
                return;
            }

            User user = new User();

            user.username = username;
            user.password = password;

            //记住密码则写入数据
            if (isSave)
            {
                userData.isSaveUser = isSave;
                userData.user       = user;
                DataUitls.saveData(userData);
            }
            else
            {
                userData.isSaveUser = false;
                userData.user       = new User();
                DataUitls.saveData(userData);
            }

            //发送HTTP请求访问服务器
            try
            {
                string url      = Resources.Server + Resources.LoginUrl;
                string data     = JsonConvert.SerializeObject(user);
                string response = HttpUitls.POST(url, data);
                OkeResult <LoginInfo> okeResult = JsonConvert.DeserializeObject <OkeResult <LoginInfo> >(response);
                if (okeResult.success)
                {
                    addAlter(EnumExtend.GetDisplayText(LoginEnum.SUCC_LOGIN), CxFlatAlertBox.AlertType.Success);
                    LoginInfo.CurrentUser.sessionId = okeResult.data.sessionId;
                    LoginInfo.CurrentUser.data      = okeResult.data.data;
                    timer.Stop();
                    timer.Tick += formClose_Tick;
                    timer.Start();
                }
                else
                {
                    addAlter(EnumExtend.GetDisplayText(LoginEnum.FAIL_LOGIN), CxFlatAlertBox.AlertType.Error);
                    unlockButton();
                }
            }
            catch (Exception)
            {
                addAlter(Resources.ExceptionTip, CxFlatAlertBox.AlertType.Error);
                unlockButton();
            }
        }
コード例 #20
0
 private SceneEnum GetActualLevel(string scene)
 {
     return(EnumExtend.ParseEnum <SceneEnum>(scene));
 }
コード例 #21
0
        public bool SaveQualityItem(XkSystem.Models.DbContext db, Quality.Entity.tbQualityItemGroup surveyGroup, HttpRequestBase request, List <Quality.Entity.tbQualityItem> surveyItems)
        {
            var txtId                = request["txtId"].Split(',');
            var txtNo                = request["txtNo"].Split(',');
            var txtName              = request["txtName"].Split(',');
            var txtIsVertical        = request["txtIsVertical"].Split(',');
            var txtQualityItemTypeId = request["txtQualityItemTypeId"].Split(',');
            var QualityItemTypeList  = typeof(Code.EnumHelper.QualityItemType).ToItemList();
            var list = (from p in db.Table <Quality.Entity.tbQualityItem>()
                        where p.tbQualityItemGroup.Id == surveyGroup.Id
                        select p).ToList();

            foreach (var a in list.Where(d => txtId.Contains(d.Id.ToString()) == false))
            {
                a.IsDeleted = true;
            }

            for (var i = 0; i < txtId.Count(); i++)
            {
                if (string.IsNullOrEmpty(txtName[i]))
                {
                    //输入内容为空,判断是否存在Id
                    if (string.IsNullOrEmpty(txtId[i]) == false)
                    {
                        //如果是有id的,那就是数据库中记录的,应该做删除
                        var tb = list.Where(d => d.Id == txtId[i].ConvertToInt()).FirstOrDefault();
                        XkSystem.Areas.Sys.Controllers.SysUserLogController.Insert("删除评价内容");
                        tb.IsDeleted = true;
                        surveyItems.Add(tb);
                    }
                }
                else
                {
                    //输入内容不为空,判断是否存在id并执行对应的操作
                    if (string.IsNullOrEmpty(txtId[i]) == false)
                    {
                        //如果有id的,执行更新操作
                        var tb = list.Where(d => d.Id == txtId[i].ConvertToInt()).FirstOrDefault();
                        XkSystem.Areas.Sys.Controllers.SysUserLogController.Insert("修改评价内容");
                        tb.No = txtNo[i].ConvertToInt();
                        tb.QualityItemName    = txtName[i];
                        tb.tbQualityItemGroup = surveyGroup;
                        tb.IsVertical         = txtIsVertical[i] == "1" ? true : false;
                        tb.QualityItemType    = EnumExtend.GetEnumName <Code.EnumHelper.QualityItemType>(QualityItemTypeList.Where(d => d.Value == txtQualityItemTypeId[i]).Select(d => d.Text).FirstOrDefault());
                        surveyItems.Add(tb);
                    }
                    else
                    {
                        //没有id的,执行插入操作
                        var tb = new Quality.Entity.tbQualityItem();
                        tb.No = txtNo[i].ConvertToInt();
                        tb.QualityItemName    = txtName[i];
                        tb.tbQualityItemGroup = surveyGroup;
                        tb.IsVertical         = txtIsVertical[i] == "1" ? true : false;
                        tb.QualityItemType    = EnumExtend.GetEnumName <Code.EnumHelper.QualityItemType>(QualityItemTypeList.Where(d => d.Value == txtQualityItemTypeId[i]).Select(d => d.Text).FirstOrDefault());
                        surveyItems.Add(tb);
                        db.Set <Quality.Entity.tbQualityItem>().Add(tb);
                        XkSystem.Areas.Sys.Controllers.SysUserLogController.Insert("添加评价内容");
                    }
                }
            }

            return(true);
        }
コード例 #22
0
ファイル: RegisterForm.cs プロジェクト: ZengYingJun97/Oke
        /// <summary>
        /// 注册按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void registerButton_Click(object sender, EventArgs e)
        {
            lockButton();

            string username        = usernameBox.Text.Trim();
            string password        = passwordBox.Text.Trim();
            string passwordConfirm = passwordConfirmBox.Text.Trim();
            string name            = nameBox.Text.Trim();
            string title           = titleBox.Text.Trim();

            //输入框不能空
            if (username.Equals("") ||
                password.Equals("") ||
                passwordConfirm.Equals("") ||
                name.Equals("") ||
                title.Equals(""))
            {
                addAlter(EnumExtend.GetDisplayText(RegisterEnum.NULLINPUT), CxFlatAlertBox.AlertType.Error);
                unlockButton();
                return;
            }

            //确认密码错误
            if (!password.Equals(passwordConfirm))
            {
                addAlter(EnumExtend.GetDisplayText(RegisterEnum.DIFFPWD), CxFlatAlertBox.AlertType.Error);
                unlockButton();
                return;
            }

            //用户名格式错误
            if (!UserUitls.IsOkUsername(username))
            {
                addAlter(EnumExtend.GetDisplayText(RegisterEnum.ERRORURN), CxFlatAlertBox.AlertType.Error);
                unlockButton();
                return;
            }

            //密码格式错误
            if (!UserUitls.IsOkPassword(password))
            {
                addAlter(EnumExtend.GetDisplayText(RegisterEnum.ERRORPWD), CxFlatAlertBox.AlertType.Error);
                unlockButton();
                return;
            }

            //姓名和职称格式错误
            if (!UserUitls.IsOkInfo(name, title))
            {
                addAlter(EnumExtend.GetDisplayText(RegisterEnum.ERROR_INFO), CxFlatAlertBox.AlertType.Error);
                unlockButton();
                return;
            }

            User user = new User();

            user.username = username;
            user.password = password;
            Teacher teacher = new Teacher();

            teacher.teacherName  = name;
            teacher.teacherTitle = title;
            teacher.user         = user;

            //发送HTTP请求访问服务器
            try
            {
                string             url       = Resources.Server + Resources.RegisterUrl;
                string             data      = JsonConvert.SerializeObject(teacher);
                string             response  = HttpUitls.POST(url, data);
                OkeResult <string> okeResult = JsonConvert.DeserializeObject <OkeResult <string> >(response);
                if (okeResult.success)
                {
                    addAlter(EnumExtend.GetDisplayText(RegisterEnum.SUCC_REGISTER), CxFlatAlertBox.AlertType.Success);
                    timer.Stop();
                    timer.Tick += formClose_Tick;
                    timer.Start();
                }
                else
                {
                    addAlter(EnumExtend.GetDisplayText(RegisterEnum.FAIL_REGISTER), CxFlatAlertBox.AlertType.Error);
                    unlockButton();
                }
            }
            catch (Exception)
            {
                addAlter(Resources.ExceptionTip, CxFlatAlertBox.AlertType.Error);
                unlockButton();
            }
            return;
        }
コード例 #23
0
        public void ChangeSlide(string nameSlider)
        {
            AudioEnum audioEnum = EnumExtend.ParseEnum <AudioEnum>(nameSlider);

            EventsManager.GetIstance <AudioManager>().SetVolume(audioEnum, sliders[audioEnum].value, true);
        }
コード例 #24
0
        private void Judgquesbtn_Click(object sender, RibbonControlEventArgs e)
        {
            //if (Globals.ThisAddIn._JudgeTaskPane != null)
            //{
            //    Globals.ThisAddIn._JudgeTaskPane.Visible = true;
            //}
            //SetQuestForm setQuestForm = new SetQuestForm();
            //setQuestForm.Show();
            //Microsoft.Office.Interop.PowerPoint.Presentation MyPres = null;//ppt实例
            Microsoft.Office.Interop.PowerPoint.Slides AllSlides = null;         //PPT中所有的幻灯片
            Microsoft.Office.Interop.PowerPoint.Slide  MySlide   = null;         //当前幻灯片
            Microsoft.Office.Interop.PowerPoint.Slide  NewSlide  = null;         //新插入的幻灯片
            AllSlides = Globals.ThisAddIn.Application.ActivePresentation.Slides; //获取当前PPT中的所有幻灯片
            MySlide   = Globals.ThisAddIn.Application.ActiveWindow.View.Slide;   //获取选中幻灯片

            #region 插入判断题 题目类型
            NewSlide = AllSlides.Add(MySlide.SlideIndex + 1, Microsoft.Office.Interop.PowerPoint.PpSlideLayout.ppLayoutBlank); //插入幻灯片

            Microsoft.Office.Interop.PowerPoint.TextRange FillTextRng = null;                                                  //设置第一个文本框
            NewSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 21.5F, 40F, 100F, 30F).Name = "JudgeQuestion";
            NewSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name            = "questionType";
            NewSlide.Shapes["questionType"].TextFrame.TextRange.Text = "2";
            NewSlide.Shapes["questionType"].Visible = MsoTriState.msoFalse;



            NewSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionScore";
            NewSlide.Shapes["questionScore"].TextFrame.TextRange.Text = "0";
            NewSlide.Shapes["questionScore"].Visible = MsoTriState.msoFalse;
            NewSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionLimitTime";
            NewSlide.Shapes["questionLimitTime"].TextFrame.TextRange.Text = "0";
            NewSlide.Shapes["questionLimitTime"].Visible = MsoTriState.msoFalse;
            NewSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0, 0, 0).Name = "questionAnswer";
            NewSlide.Shapes["questionAnswer"].TextFrame.TextRange.Text = "0";
            NewSlide.Shapes["questionAnswer"].Visible = MsoTriState.msoFalse;


            FillTextRng = NewSlide.Shapes["JudgeQuestion"].TextFrame.TextRange;                                                 //请注意此处Shapes的索引,由于文本框是第一个添加的Shapes,所以此处索引是1。

            FillTextRng.Font.NameFarEast                = "微软雅黑";                                                               //文本框中,中文的字体
            FillTextRng.Font.NameAscii                  = "Calibri";                                                            //文本框中,英文和数字的字体
            FillTextRng.Text                            = "判断题";                                                                //显示的内容
            FillTextRng.Font.Bold                       = MsoTriState.msoTrue;                                                  //是否加粗
            FillTextRng.Font.Color.RGB                  = 1 + 1 * 256 + 1 * 256 * 256;                                          //字体颜色,其中ABC直接用自定义颜色中的数字代替即可。
            FillTextRng.Font.Size                       = 24;                                                                   //字体大小是24.
            FillTextRng.ParagraphFormat.Alignment       = Microsoft.Office.Interop.PowerPoint.PpParagraphAlignment.ppAlignLeft; //文本对齐方式(水平方向)
            NewSlide.Shapes[1].TextFrame.VerticalAnchor = MsoVerticalAnchor.msoAnchorMiddle;                                    //文本对齐方式(垂直方向)
            NewSlide.Select();
            #endregion
            #region 插入判断题题目
            Microsoft.Office.Interop.PowerPoint.TextRange FQTextRng = null;

            NewSlide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, 21.5F, 150F, 400F, 300F).Name = "questionDescribe";

            //添加True & False图片 从网上获取
            NewSlide.Shapes.AddPicture("http://pic.616pic.com/ys_b_img/00/57/95/CLa3kvD1Kw.jpg", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, 21, 400, 70, 50).Name  = "answerisTrue";
            NewSlide.Shapes.AddPicture("http://pic.616pic.com/ys_b_img/00/11/88/mktrxpmh8r.jpg", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, 200, 400, 70, 50).Name = "answerisFalse";
            NewSlide.Shapes["answerisTrue"].Visible  = MsoTriState.msoTrue;
            NewSlide.Shapes["answerisFalse"].Visible = MsoTriState.msoTrue;
            FQTextRng = NewSlide.Shapes["questionDescribe"].TextFrame.TextRange;                                                //请注意此处Shapes的索引,由于文本框是第二个添加的Shapes,所以此处索引是2。

            FQTextRng.Font.NameFarEast                  = "微软雅黑";                                                               //文本框中,中文的字体
            FQTextRng.Font.NameAscii                    = "Calibri";                                                            //文本框中,英文和数字的字体
            FQTextRng.Text                              = "请编写题干";                                                              //cxFlatTextArea1.Text;//显示的内容
            FQTextRng.Font.Bold                         = MsoTriState.msoFalse;                                                 //是否加粗
            FQTextRng.Font.Color.RGB                    = 1 + 1 * 256 + 1 * 256 * 256;                                          //字体颜色,其中ABC直接用自定义颜色中的数字代替即可。
            FQTextRng.Font.Size                         = 24;                                                                   //字体大小是24.
            FQTextRng.ParagraphFormat.Alignment         = Microsoft.Office.Interop.PowerPoint.PpParagraphAlignment.ppAlignLeft; //文本对齐方式(水平方向)
            NewSlide.Shapes[2].TextFrame.VerticalAnchor = MsoVerticalAnchor.msoAnchorMiddle;                                    //文本对齐方式(垂直方向)
            #endregion
            #region 添加对错按钮
            //AddOleForm1(NewSlide, 21.5F, 400F, 70F, 50F, "True", 1);
            //AddOleForm1(NewSlide, 200F, 400F, 70F, 50F, "False", 2);

            //Image image1 = Properties.Resources.Oke_true;
            //Image image2 = Properties.Resources.Oke_false;
            //String image_path1 = Application.StartupPath + @"..\\..\\Resources\\Oke_true.png";
            //String image_path2 = @"..\\..\\Resources\\Oke_false.png";
            //MySlide.Shapes.AddPicture(image_path1, MsoTriState.msoFalse, MsoTriState.msoTrue, 27F, 24F, 665F, 333F);

            //presentation.Slides[0].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
            //AddSubmitOleForm1(NewSlide, 822F, 466F, 89F, 46F);
            AddSubmitOleForm(NewSlide, 727F, 466F, 80F, 46F, EnumExtend.GetDisplayText(ButtonNameEnum.GETANS), "answerButton");
            AddSubmitOleForm(NewSlide, 822F, 466F, 80F, 46F, EnumExtend.GetDisplayText(ButtonNameEnum.SUMBIT), "sumbitButton");

            #endregion
        }