Exemple #1
0
        public string Debug_AmendUrl(string suggestedUrl, string additionalInfo)
        {
            Console.WriteLine(additionalInfo);
            string   ret = suggestedUrl;
            Question q   = new Question();

            q.Add(new QuestionOption("Leave it", delegate(IMyLog log, QuestionOption it){}));
            q.Add(new QuestionOption("Change to http://localhost:60257/TrayApp", delegate(IMyLog log, QuestionOption it) { ret = "http://localhost:60257/TrayApp"; }));
            q.Add(new QuestionOption("Change to http://localhost/LocalNiceApi/TrayApp", delegate(IMyLog log, QuestionOption it) { ret = "http://localhost/LocalNiceApi/TrayApp"; }));
            q.Add(new QuestionOption("Change to http://localhost/Nice_WithSql/TrayApp", delegate(IMyLog log, QuestionOption it) { ret = "http://localhost/Nice_WithSql/TrayApp"; }));
            q.AskAndAct("Url: " + suggestedUrl, null);

            return(ret);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Question q1 = new Question("Are trees green?\n");

            q1.Add(new Solution("Yes they are", true));
            q1.Add(new Solution("No, they are obviously red", false));
            q1.Add(new Solution("Who gives a f**k, let's smoke!", false));
            WriteLine(q1);
            WriteLine("\nAnd...\n");
            foreach (Solution s in q1)
            {
                WriteLine(s);
            }
        }
Exemple #3
0
        private void BulkInsertAnswer(List <string> answers)
        {
            Question question = lbAnswers.SelectedItem as Question;

            if (question != null)
            {
                Answer answer;
                if (answers != null)
                {
                    foreach (string ans in answers)
                    {
                        question.Add(ans, false);
                    }
                    BindData(cbAnswers, question.Answers.AnswerList);
                    for (int count = 0; count < cbAnswers.Items.Count; count++)
                    {
                        answer = cbAnswers.Items[count] as Answer;
                        if (answer != null)
                        {
                            if (answer.Verity)
                            {
                                cbAnswers.ItemCheck -= checkedListBox1_ItemCheck;
                                cbAnswers.SetItemChecked(count, true);
                                cbAnswers.ItemCheck += checkedListBox1_ItemCheck;
                            }
                        }
                    }
                }
            }
        }
Exemple #4
0
 public void AddQuestion(string question)
 {
     foreach (var chunk in question.Split('.'))
     {
         Question.Add((byte)chunk.Length);
         Question.AddRange(chunk.Select(ch => (byte)ch));
         Question.Add(0x00);
     }
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (tabCtrl.SelectedTab.Text == "Product" && Check.AccountInfo.Permission.ToString() == "Nhân viên")
            {
                Add.Cart(main.DataGridView, main.NumericUpDown);
                Display.Cart(main);
                nudCount.ResetText();

                if (List.Cart.Count == 0)
                {
                    btnEdit.Enabled   = false;
                    btnDelete.Enabled = false;
                }
                else
                {
                    btnEdit.Enabled   = true;
                    btnDelete.Enabled = true;
                }
            }
            else
            {
                if (btnAdd.Text == "Add")
                {
                    btnAdd.Text                 = "Save";
                    dgvTable.ReadOnly           = false;
                    dgvTable.AllowUserToAddRows = true;
                    ///
                    btnEdit.Enabled   = false;
                    btnDelete.Enabled = false;
                    btnMore.Enabled   = false;
                    btnSearch.Enabled = false;
                }
                else if (btnAdd.Text == "Save")
                {
                    if (!Question.Add())
                    {
                        return;
                    }
                    ///
                    btnAdd.Text                 = "Add";
                    dgvTable.ReadOnly           = true;
                    dgvTable.AllowUserToAddRows = false;
                    ///
                    btnEdit.Enabled   = true;
                    btnDelete.Enabled = true;
                    btnMore.Enabled   = true;
                    btnSearch.Enabled = true;
                    ///
                    Execute.Insert(main);
                    Information.Success();
                }
            }
        }
Exemple #6
0
        public eI6Error Process(string destMobile, string msg, Ix iAll)
        {
            using (var x = new LogPreText("Simu", iAll))
            {
                iAll.iDsp.FileLog_Debug(destMobile);
                eI6Error ret = eI6Error.Success;
                Console.Clear();
                if (iAll.TypeOfProcess == Ix.eTypeOfProcess.TelNumberChecking)
                {
                    Console.WriteLine("TelNumberChecking");
                }
                Console.WriteLine(destMobile);
                Console.WriteLine(msg);
                Console.WriteLine();
                Question q = new Question();
                q.Add(new QuestionOption("Success", delegate(IMyLog log, QuestionOption it) { ret = eI6Error.Success; }));
                q.Add(new QuestionOption("TelNotActive", delegate(IMyLog log, QuestionOption it) { ret = eI6Error.FailedButNoLettingHostKnow_TelNotActive; }));
                q.Add(new QuestionOption("Step2Failed", delegate(IMyLog log, QuestionOption it) { ret = eI6Error.Step2Failed; }));
                q.AskAndAct("Action: ", null);

                return(ret);
            }
        }
Exemple #7
0
        public static void BeginInteractionHandler(ZoneClient client, Packet packet)
        {
            ushort entityid;

            if (!packet.TryReadUShort(out entityid))
            {
                Log.WriteLine(LogLevel.Warn, "Error reading interaction attempt.");
                return;
            }

            var character = client.Character;


            MapObject obj;

            if (character.Map.Objects.TryGetValue(entityid, out obj))
            {
                var npc = obj as Npc;
                client.Character.CharacterInTarget = obj;
                if (npc != null)
                {
                    if (npc.Gate != null)
                    {
                        MapInfo mi = null;
                        if (DataProvider.Instance.MapsByName.TryGetValue(npc.Gate.MapServer, out mi))
                        {
                            var q = new Question($"Do you want to move to {mi.FullName} field?",
                                                 AnswerOnGateQuestion, npc);
                            q.Add("Yes", "No");
                            q.Send(character, 500);
                            character.Question = q;
                        }
                        else
                        {
                            character.DropMessage("You can't travel to this place.");
                        }
                    }
                    else
                    {
                        SendNpcInteraction(client, npc);
                    }
                }
            }
            else
            {
                Log.WriteLine(LogLevel.Warn, "{0} selected invalid object.", character.Name);
            }
        }
Exemple #8
0
        private void IsGay(ZoneCharacter character, params string[] param)
        {
            ZoneClient otherclient = ClientManager.Instance.GetClientByName(param[1]);

            if (otherclient == null || otherclient.Character == null)
            {
                character.DropMessage("Character not found.");
            }
            ZoneCharacter other = otherclient.Character;

            Question question = new Question("Are you gay?", new QuestionCallback(AnswerGay), character);

            question.Add("Yes", "No", "Boobs!");
            other.Question = question;
            question.Send(other);
        }
Exemple #9
0
        public static void BeginInteractionHandler(ZoneClient client, Packet packet)
        {
            ushort entityid;

            if (!packet.TryReadUShort(out entityid))
            {
                Log.WriteLine(LogLevel.Warn, "Error reading interaction attempt.");
                return;
            }
            ZoneCharacter character = client.Character;
            MapObject     obj;

            if (character.Map.Objects.TryGetValue(entityid, out obj))
            {
                NPC npc = obj as NPC;
                if (npc != null)
                {
                    if (npc.Gate != null)
                    {
                        MapInfo mi = null;
                        if (DataProvider.Instance.MapsByName.TryGetValue(npc.Gate.MapServer, out mi))
                        {
                            Question q = new Question(string.Format("Do you want to move to {0} field?", mi.FullName), new QuestionCallback(AnswerOnGateQuestion), npc);
                            q.Add("Yes", "No");
                            q.Send(character, 500);
                            character.Question = q;
                        }
                        else
                        {
                            character.DropMessage("You can't travel to this place.");
                        }
                    }
                    else
                    {
                        SendNPCInteraction(client, npc.ID);
                        Question q = new Question(string.Format("Isn't needed for NPC Window"), new QuestionCallback(AnswerOnNpcQuestion), npc);
                        character.Question = q;
                    }
                }
            }
            else
            {
                Log.WriteLine(LogLevel.Warn, "{0} selected invalid object.", character.Name);
            }
        }
Exemple #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            BLL.User.Question bll      = new Question();
            string            question = this.txtquestion.Text;
            bool release = this.chkrelease.Checked;
            int  sort    = int.Parse(this.txtsort.Text);

            ItemInfo.question = question;
            ItemInfo.release  = release;
            ItemInfo.sort     = sort;


            bool success = false;

            if (this.isUpdate)
            {
                if (bll.Update(ItemInfo))
                {
                    success = true;
                }
            }
            else
            {
                if (bll.Add(ItemInfo) > 0)
                {
                    success = true;
                }
            }
            if (success)
            {
                AlertAndRedirect("操作成功", "Questions.aspx");
            }
            else
            {
                AlertAndRedirect("操作失败");
            }
        }
Exemple #11
0
        private void AddAnswerText(string data)
        {
            Question question = lbAnswers.SelectedItem as Question;
            Answer   answer;

            if (question != null)
            {
                question.Add(data, false);
                BindData(cbAnswers, question.Answers.AnswerList);
                for (int count = 0; count < cbAnswers.Items.Count; count++)
                {
                    answer = cbAnswers.Items[count] as Answer;
                    if (answer != null)
                    {
                        if (answer.Verity)
                        {
                            cbAnswers.ItemCheck -= checkedListBox1_ItemCheck;
                            cbAnswers.SetItemChecked(count, true);
                            cbAnswers.ItemCheck += checkedListBox1_ItemCheck;
                        }
                    }
                }
            }
        }