Beispiel #1
0
 private void PictureBox_Click(object sender, EventArgs e)
 {
     SelectedPixel = MouseOnPixel;
     if (NewTool != null)
     {
         NewTool.SetPosition(SelectedPixel);
         theme.AddTool(NewTool); // Add new tool to collection
         Control.propertyGrid1.SelectedObject = NewTool;
         NewToolAdded();         // call method for reset NewTool and set focus on button_pointer
         NewTool = null;
         Theme_Changed();
     }
     SelectedTool = null;
     Control.PictureBox.Cursor = System.Windows.Forms.Cursors.Default;
     foreach (LB_Tools_Interface tool in theme.GetTools())
     {
         if (LB_Tools.isItToolArea(tool, SelectedPixel))
         {
             Control.propertyGrid1.SelectedObject = tool;
             SelectedTool = tool;
             Control.PictureBox.Cursor = System.Windows.Forms.Cursors.SizeAll;
         }
     }
     if (SelectedTool == null)
     {
         Control.propertyGrid1.SelectedObject = theme;
     }
     tabPage.Focus();
     Control.PictureBox.Invalidate();
 }
Beispiel #2
0
        private void ViewModel_OnFsExplorerTabAdded(KeyValuePair <int, FsExplorerViewModel> kvp)
        {
            this.tabControlFsExplorer.Focus();
            var control = new FsExplorerPageUserControl();

            control.Dock       = DockStyle.Top;
            control.AutoScroll = true;

            control.SetViewModel(kvp.Value);
            control.Height = 2000;

            var tabPage = new TabPage(kvp.Value.CurrentDirName);

            tabPage.AutoScroll = true;

            kvp.Value.CurrentFsDirNameChanged += () =>
            {
                tabPage.Text = kvp.Value.CurrentDirName;
            };

            tabPage.Controls.Add(control);
            this.tabControlFsExplorer.TabPages.Insert(kvp.Key, tabPage);

            tabPage.Focus();
            control.FocusControl();
        }
        // Trigger when user click "Add Candidate" button
        // add new Candidate to the current Question
        private void addCandidateBtn_Click(object sender, EventArgs e)
        {
            if (currentQuestion == null)
            {
                MessageBox.Show("You need to choose a question.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Candidate c = new Candidate();

            if (currentQuestion.Candidates.Count() == 0)
            {
                c.CandidateId = 1;
            }
            else
            {
                // increase last CandidateId by 1
                c.CandidateId = currentQuestion.Candidates[currentQuestion.Candidates.Count() - 1].CandidateId + 1;
            }
            c.QuestionType = Candidate.QuestionTypes.Query;

            currentQuestion.Candidates.Add(c);
            TabPage tp = new TabPage("Candidate " + currentQuestion.Candidates.Count());

            CandidatePanel candidatePanel = new CandidatePanel(c, this.HandleDeleteCandidate);

            tp.Controls.Add(candidatePanel);
            candidateControl.TabPages.Add(tp);

            // focus new tab
            candidateControl.SelectedIndex = candidateControl.TabCount - 1;
            tp.Focus();
        }
Beispiel #4
0
        private void crearVentana(string nombre, string texto, string ruta)
        {
            rut = ruta;
            nom = nombre;
            //   Console.WriteLine(texto);
            TabPage nuevo = new TabPage();

            nuevo.Name = nombre;
            nuevo.Text = nombre;
            FastColoredTextBox r = new FastColoredTextBox();

            r.WordWrap       = true;
            r.ShowScrollBars = true;
            r.Height         = 365;
            r.Width          = 1203;
            r.TextChanged   += fastColoredTextBox1_TextChanged;
            //r.AddStyle(GreenStyle);
            r.BorderStyle = System.Windows.Forms.BorderStyle.None;
            r.Name        = ruta;
            r.Text        = texto;
            nuevo.Focus();
            nuevo.Controls.Add(r);
            this.tabPrincipal.Controls.Add(nuevo);

            comboBox1.Items.Add(nombre);
            comboBox1.SelectedItem   = nombre;
            tabPrincipal.SelectedTab = nuevo;



            tabPrincipal.KeyDown    += this.AreaLugar;
            tabPrincipal.MouseClick += this.AreaLugar;
            tabPrincipal.KeyPress   += this.AreaLugar;
            // nombreHoja.Text = ""; //descomentar
        }
Beispiel #5
0
        }   //  ShowLongParticipialForms (...)

/*
 *      protected void Preprocess (string sSearchString)
 *      {
 *          int i_Stress = Convert.ToInt32(true); // It should've been bool
 *          if (Regex.IsMatch (sSearchString, (string)">"))
 *          {
 *              i_Stress = Convert.ToInt32(true);
 *          }
 *          else
 *          {
 *              i_Stress = Convert.ToInt32(true); // Test
 *          }
 *          sSearchString = sSearchString.Replace(">", "");
 *          if (Regex.IsMatch (sSearchString, (string)"\\-"))
 *          {
 *              string[] arr_Range = Regex.Split (sSearchString, (string)"([0-9]*)\\-([0-9]*)");
 *              long l_start_id = long.Parse(arr_Range[1]);
 *              long l_end_id = long.Parse(arr_Range[2]);
 *              m_LexPreprocessor.PrepareLexemes (l_start_id, l_end_id, i_Stress);
 *          }
 *          else
 *          {
 *              long l_lexeme_id = long.Parse (sSearchString);
 *              m_LexPreprocessor.PrepareLexeme(l_lexeme_id, i_Stress);
 *          }
 *
 *      }   //  Preprocess (...)
 */
        protected void ShowParseOutput()
        {
            int iWordform = 0, iPreviousID = -1;

            tabControl.TabPages.Clear();

            if (null == m_Parser)
            {
                MessageBox.Show("Internal error: Parser object is null.", "Zal error", MessageBoxButtons.OK);
                return;
            }

            int iWordForm             = 0;
            CWordFormManaged wordform = null;
            EM_ReturnCode    eRet     = (EM_ReturnCode)m_Parser.eGetFirstWordForm(ref wordform);

            if (CErrorCode.bError(eRet))
            {
                MessageBox.Show("Error");
                return;
            }
            if (EM_ReturnCode.H_NO_ERROR != eRet)
            {
                MessageBox.Show("Form not found");
                return;
            }

            do
            {
                m_listWordForms.Add(wordform);
                AnalysisPanel ap = new AnalysisPanel(iWordform);
//                ap.Location = new System.Drawing.Point(0, iWordform * ap.Size.Height + 4);
                string sWordForm = wordform.sWordForm();
                MarkStress(ref sWordForm, wordform);
                ap.sWordform       = sWordForm;
                ap.sID             = wordform.llLexemeId().ToString();
                ap.eoPOS           = wordform.ePos();
                ap.eoAspect        = wordform.eAspect();
                ap.eoGender        = wordform.eGender();
                ap.eoCase          = wordform.eCase();
                ap.eoNumber        = wordform.eNumber();
                ap.eoAnimacy       = wordform.eAnimacy();
                ap.eoPerson        = wordform.ePerson();
                ap.eoReflexiveness = wordform.eReflexive();
                ap.eoSubparadigm   = wordform.eSubparadigm();
                iWordform          = 0;
                iPreviousID        = (int)wordform.llLexemeId();
                TabPage tab_Lexeme = new TabPage(wordform.sWordForm());
//                tab_Lexeme.Text = wordform.sWordForm();
                tab_Lexeme.AutoScroll = true;
                tab_Lexeme.Controls.Add(ap);
                tabControl.TabPages.Add(tab_Lexeme);
                tab_Lexeme.Show();
                tab_Lexeme.Focus();
                ++iWordform;
                ap.Show();

                eRet = (EM_ReturnCode)m_Parser.eGetNextWordForm(ref wordform);
            } while (EM_ReturnCode.H_NO_ERROR == eRet);
        }   //  ShowParseOutput()
Beispiel #6
0
        //接受请求
        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (drpChatRequest.SelectedItem != null)
            {
                //声音
                player.Stop();
                //请求信息
                ChatRequestInfo req = (ChatRequestInfo)drpChatRequest.SelectedItem;
                drpChatRequest.Items.Remove(req);
                drpChatRequest.Text = string.Empty;

                TabPage  tab = new TabPage(req.VisitorIP);
                LiveChat lc  = new LiveChat();
                lc.Tag         = tabChats;
                lc.ChatRequest = req;
                lc.Dock        = DockStyle.Fill;
                tab.Controls.Add(lc);
                tabChats.TabPages.Add(tab);
                tab.Focus();

                TabInfo tabInfo = new TabInfo();
                tabInfo.ChatId = req.ChatId;
                tabInfo.Dock   = DockStyle.Fill;
                if (currentVisitors.ContainsKey(req.VisitorIP))
                {
                    tabInfo.RequestEntity = currentVisitors[req.VisitorIP] as RequestInfo;
                }
                //添加请求信息
                chatInfo.Add(tabInfo);
                RefreshTabInfo();
                //修改客服编号
                ws.AcceptChatRequest(req.ChatId, Program.CurrentOperator.Id);//服务人员
            }
        }
 public void Enter(KeyEventArgs e, TabPage tp)
 {
     if (e.KeyCode == Keys.Enter)
     {
         tp.Focus();
     }
 }
Beispiel #8
0
 private void renameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (projectExplorerBox.SelectedItem == null || OpenedProject == null)
         {
             return;
         }
         string methodName = projectExplorerBox.SelectedItem.ToString().Remove(0, "Module ".Length);
         string newname    = methodName;
         if (codeTabControl.TabPages.ContainsKey(methodName))
         {
             TabPage pg = codeTabControl.TabPages[codeTabControl.TabPages.IndexOfKey(methodName)];
             foreach (Control a in pg.Controls)
             {
                 a.LostFocus -= codeTextBox_Leave;
             }
             pg.Focus();
         }
         if (InputBox.ShowDialog("Changing method name", "Input new name", ref newname) == DialogResult.OK)
         {
             if (methodName.ToUpper() == "MAIN")
             {
                 if (newname.ToUpper() != "MAIN")
                 {
                     MessageBox.Show("Main method must be called as 'Main'");
                     return;
                 }
                 else
                 {
                     OpenedProject.RenameMethod(methodName, newname);
                 }
             }
             else
             {
                 OpenedProject.RenameMethod(methodName, newname);
             }
             projectExplorerBox.Items.Clear();
             foreach (var k in OpenedProject.FileNames)
             {
                 projectExplorerBox.Items.Add("Module " + k.Key);
             }
             if (codeTabControl.TabPages.ContainsKey(methodName))
             {
                 codeTabControl.TabPages.RemoveByKey(methodName);
                 OpenTab(newname);
             }
             foreach (TabPage a in codeTabControl.TabPages)
             {
                 LoadCodeToTab(a);
             }
         }
     }
     catch (Exception exp)
     {
         MessageBox.Show(exp.Message);
     }
 }
Beispiel #9
0
 /// <exception cref="System.ArgumentNullException" />
 public void OpenTab(TabPage tabPage)
 {
     tabPage = tabPage ?? throw new ArgumentNullException(nameof(tabPage));
     if (!_terminal.TabPages.Contains(tabPage))
     {
         _terminal.TabPages.Add(tabPage);
     }
     _terminal.SelectedTab = tabPage;
     tabPage.Focus();
 }
Beispiel #10
0
 private void canvas_Click(object sender, EventArgs e)
 {
     canvas.Focus();
     foreach (CreatorObject curObj in currentCard.objects)
     {
         if (curObj.type == Constant.textFile)
         {
             curObj.textbox.Select(curObj.textbox.Text.Length, 0);
         }
     }
 }
Beispiel #11
0
            protected sealed override void OnGotFocus(EventArgs e)
            {
                TabPage tabPage = base.SelectedTab;

                if (tabPage != null)
                {
                    tabPage.Focus();
                    if (DocView.UpdateToolboxDiagram(((DiagramTabPage)tabPage).Diagram))
                    {
                        DocView.RefreshDiagramToolboxItems();
                    }
                }
            }
 private void keyUp(object sender, KeyEventArgs e)
 {
     Key = (VirtualKey)e.KeyValue;
     if (Key == VirtualKey.Escape)
     {
         hotkeyTextBox.Text = "Unbound";
     }
     else
     {
         hotkeyTextBox.Text = Key.ToString();
     }
     e.Handled = true;
     hotkeyTabPage.Focus();
 }
        public void NewTabToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TabPagesControl tb = new TabPagesControl();

            tb.Dock = DockStyle.Fill;
            TabPage newTab = new TabPage("New Tab");

            newTab.Controls.Add(tb);
            tabControl1.TabPages.Add(newTab);
            newTab.Text = tb.getTabName();
            newTab.Focus();



            //open new tab from file
        }
Beispiel #14
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            // Accept a new chat request
            if (drpChatRequest.SelectedItem != null)
            {
                player.Stop();


                ChatRequest req = (ChatRequest)drpChatRequest.SelectedItem;

                // Remove the chat request from the combo
                drpChatRequest.Items.Remove(req);
                drpChatRequest.Text = string.Empty;

                // Accept the chat request
                ws.AcceptRequest(new Guid(Program.CurrentOperator.Password), req.ChatId, Program.CurrentOperator.OperatorId);

                // Add a new tab page that will contain the chat session
                TabPage  tab = new TabPage(req.VisitorIp);
                LiveChat lc  = new LiveChat();
                lc.ChatRequest = req;
                lc.Dock        = DockStyle.Fill;
                tab.Controls.Add(lc);
                tabChats.TabPages.Add(tab);
                tab.Focus();

                // Add a new TabInfo control
                TabInfo tabInfo = new TabInfo();
                tabInfo.ChatId      = req.ChatId;
                tabInfo.ChatRequest = req;
                tabInfo.MyTab       = tab;
                tabInfo.Dock        = DockStyle.Fill;



                // Get the request
                if (currentVisitors.ContainsKey(req.VisitorIp))
                {
                    tabInfo.RequestEntity = currentVisitors[req.VisitorIp] as WebRequest;
                }


                chatInfo.Add(tabInfo);
                RefreshTabInfo();
            }
        }
Beispiel #15
0
        private void btnInvite_Click(object sender, EventArgs e)
        {
            if (lstVisitors.SelectedIndices.Count > 0)
            {
                List <string> ips = new List <string>();
                foreach (int item in lstVisitors.SelectedIndices)
                {
                    ips.Add(lstVisitors.Items[item].SubItems[2].Text);
                }

                if (MessageBox.Show("Are you sure you want to invite " + ips.Count + " visitor(s)?", "LCSK", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    foreach (string ip in ips)
                    {
                        ChatRequest req = ws.Invite(new Guid(Program.CurrentOperator.Password), Program.CurrentOperator.OperatorId, ip, "");

                        // Add a new tab page that will contain the chat session
                        TabPage  tab = new TabPage(req.VisitorIp);
                        LiveChat lc  = new LiveChat();
                        lc.ChatRequest = req;
                        lc.Dock        = DockStyle.Fill;
                        tab.Controls.Add(lc);
                        tabChats.TabPages.Add(tab);
                        tab.Focus();

                        // Add a new TabInfo control
                        TabInfo tabInfo = new TabInfo();
                        tabInfo.ChatId      = req.ChatId;
                        tabInfo.ChatRequest = req;
                        tabInfo.MyTab       = tab;
                        tabInfo.Dock        = DockStyle.Fill;

                        // Get the request
                        if (currentVisitors.ContainsKey(req.VisitorIp))
                        {
                            tabInfo.RequestEntity = currentVisitors[req.VisitorIp] as WebRequest;
                        }

                        chatInfo.Add(tabInfo);
                        RefreshTabInfo();
                    }
                }
            }
        }
Beispiel #16
0
        private void MainForm1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                // Return focus to main form
                if (mActiveTabPage != null)
                {
                    mActiveTabPage.Focus();
                }
                return;
            }

            if (mActiveTabPage != null)
            {
                TabPanelData data = (TabPanelData)mTabMap[mActiveTabPage];

                if (data.mListener != null)
                {
                    data.mListener.OnKeyDown(sender, e);
                }
            }
        }
Beispiel #17
0
        /// <summary>
        /// Crea un nuevo tab, asigna un ID y un texto que se mostrará en la pestaña
        /// </summary>
        /// <param name="IDTab"></param>
        /// <param name="TextTab"></param>
        /// <returns>Devuelve el <code>FastColoredTextBox</code> que se insertó dentro del Tab recién creado</returns>
        private FastColoredTextBox NewTab(String IDTab, String TextTab)
        {
            //Instancia un nuevo tab y un cuadro de texto
            TabPage tabPage = new TabPage
            {
                Text = TextTab,
                Name = IDTab
            };
            FastColoredTextBox textBox = new FastColoredTextBox
            {
                Name           = "txt" + IDTab,
                ShowScrollBars = true,
                Dock           = DockStyle.Fill
            };

            textBox.TextChanged += TextBox_TextChanged; //new EventHandler(TextBox_TextChanged);
            //Añade el textbox al tab
            tabPage.Controls.Add(textBox);
            //Añada el tab al control de Tab
            this.TabInput.Controls.Add(tabPage);
            //Hace focus a la pestaña recién creada
            tabPage.Focus();
            return(textBox);
        }
Beispiel #18
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     activeTab = tabControl1.SelectedTab;
     activeTab.Focus();
 }
Beispiel #19
0
 private void 邀请对话ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (lstVisitors.SelectedItems.Count > 0)
     {
         if (IsIP == lstVisitors.SelectedItems[0].SubItems[2].Text)
         {
             DialogResult choice = MessageBox.Show("你已向该用户发出请求", "是否重发?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
             if (choice == DialogResult.OK)
             {
                 RequestInfo     info        = this.lstVisitors.SelectedItems[0].Tag as RequestInfo;
                 ChatRequestInfo requestinfo = new ChatRequestInfo();
                 requestinfo.ChatId               = Guid.NewGuid().ToString();                     //chatid
                 requestinfo.AccountId            = info.AccoutId.ToString();
                 requestinfo.VisitorIP            = lstVisitors.SelectedItems[0].SubItems[2].Text; //IP
                 requestinfo.AcceptByOpereratorId = Program.CurrentOperator.Id;                    //服务人员
                 requestinfo.RequestDate          = DateTime.Now;
                 requestinfo.VisitorName          = "";
                 requestinfo.VisitorEmail         = "";
                 requestinfo.VisitorUserAgent     = lstVisitors.SelectedItems[0].SubItems[4].Text;//浏览器
                 requestinfo.WasAccept            = false;
                 //信息显示
                 TabPage  tab = new TabPage(requestinfo.VisitorIP);
                 LiveChat lc  = new LiveChat();
                 lc.Tag         = tabChats;
                 lc.ChatRequest = requestinfo;
                 lc.Dock        = DockStyle.Fill;
                 tab.Controls.Add(lc);
                 tabChats.TabPages.Add(tab);
                 tab.Focus();
                 TabInfo tabInfo = new TabInfo();
                 tabInfo.ChatId = requestinfo.ChatId;
                 tabInfo.Dock   = DockStyle.Fill;
                 if (currentVisitors.ContainsKey(requestinfo.VisitorIP))
                 {
                     tabInfo.RequestEntity = currentVisitors[requestinfo.VisitorIP] as RequestInfo;
                 }
                 //修改请求信息
                 chatInfo.Add(tabInfo);
                 RefreshTabInfo();
                 IsIP = lstVisitors.SelectedItems[0].SubItems[2].Text;
                 ws.TransferChat(requestinfo);
                 //修改客服编号
                 ws.AcceptChatRequest(requestinfo.ChatId, Program.CurrentOperator.Id);//服务人员
             }
         }
         else
         {
             DialogResult choice = MessageBox.Show("是否确认发出邀请", "YesNo?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (choice == DialogResult.Yes)
             {
                 RequestInfo     info        = this.lstVisitors.SelectedItems[0].Tag as RequestInfo;
                 ChatRequestInfo requestinfo = new ChatRequestInfo();
                 requestinfo.ChatId               = Guid.NewGuid().ToString();                     //chatid
                 requestinfo.AccountId            = info.AccoutId.ToString();
                 requestinfo.VisitorIP            = lstVisitors.SelectedItems[0].SubItems[2].Text; //IP
                 requestinfo.AcceptByOpereratorId = Program.CurrentOperator.Id;                    //服务人员
                 requestinfo.RequestDate          = DateTime.Now;
                 requestinfo.VisitorName          = "";
                 requestinfo.VisitorEmail         = "";
                 requestinfo.VisitorUserAgent     = lstVisitors.SelectedItems[0].SubItems[4].Text;//浏览器
                 requestinfo.WasAccept            = false;
                 ws.TransferChat(requestinfo);
                 IsIP = lstVisitors.SelectedItems[0].SubItems[2].Text;
                 //信息显示
                 TabPage  tab = new TabPage(requestinfo.VisitorIP);
                 LiveChat lc  = new LiveChat();
                 lc.Tag         = tabChats;
                 lc.ChatRequest = requestinfo;
                 lc.Dock        = DockStyle.Fill;
                 tab.Controls.Add(lc);
                 tabChats.TabPages.Add(tab);
                 tab.Focus();
                 TabInfo tabInfo = new TabInfo();
                 tabInfo.ChatId = requestinfo.ChatId;
                 tabInfo.Dock   = DockStyle.Fill;
                 if (currentVisitors.ContainsKey(requestinfo.VisitorIP))
                 {
                     tabInfo.RequestEntity = currentVisitors[requestinfo.VisitorIP] as RequestInfo;
                 }
                 //修改请求信息
                 chatInfo.Add(tabInfo);
                 RefreshTabInfo();
             }
         }
     }
     else
     {
         MessageBox.Show("你还没有选择跟谁进行对话", "请选择", MessageBoxButtons.OK, MessageBoxIcon.Stop);
     }
 }