Ejemplo n.º 1
0
        private void XtraForm1_FormClosing(object sender, FormClosingEventArgs e)
        {
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction action = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
            {
                Caption = "Xác nhận", Description = "Bạn muốn thoát khỏi ứng dụng?"
            };
            Predicate <DialogResult> predicate = canCloseFunc;

            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
            {
                Text = "Có", Result = System.Windows.Forms.DialogResult.Yes
            };
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
            {
                Text = "Không", Result = System.Windows.Forms.DialogResult.No
            };
            action.Commands.Add(command1);
            action.Commands.Add(command2);
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties properties = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties();
            properties.ButtonSize = new Size(100, 40);
            properties.Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox;
            if (DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this, action, properties, predicate) == System.Windows.Forms.DialogResult.Yes)
            {
                e.Cancel = false;
                UpdateAppSettings("LightMode", light.ToString());
                UpdateAppSettings("WordSize", wordsize.ToString());
                UpdateAppSettings("Sotuhoc", Sotuhoc.ToString());
            }
            else
            {
                e.Cancel = true;
            }
        }
Ejemplo n.º 2
0
 private void Button12_Click(object sender, EventArgs e)
 {
     if (listView7.SelectedItems.Count == 0)
     {
         DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction action2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
         {
             Caption = "Thông báo", Description = "Hãy chọn ít nhất 1 từ để xóa khỏi bộ sưu tập"
         };
         Predicate <DialogResult> predicate2 = canCloseFunc;
         DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command1_2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
         {
             Text = "OK", Result = System.Windows.Forms.DialogResult.OK
         };
         action2.Commands.Add(command1_2);
         DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties properties2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties();
         properties2.ButtonSize = new Size(100, 40);
         properties2.Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox;
         DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this, action2, properties2, predicate2);
         return;
     } //replace with flyout dialog
     foreach (ListViewItem word in listView7.SelectedItems)
     {
         mainProc.removeFromCollection(word.Text, tempSelectCollection);
         List <string> result = mainProc.collectionWordListing(listView6.SelectedItems[0].Text);
         listView7.Items.Clear();
         listView7.BeginUpdate();
         foreach (var entry in result)
         {
             listView7.Items.Add(entry);
         }
         listView7.EndUpdate();
     }
 }
Ejemplo n.º 3
0
        private void Button4_Click(object sender, EventArgs e)
        {
            //Bookmark button
            //If isBookmarked == true unbookmark
            //If isBookmarked == false bookmark
            bool res;

            if (curNode == null)
            {
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction action2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
                {
                    Caption = "Thông báo", Description = "Xin hãy chọn từ trước khi bookmark"
                };
                Predicate <DialogResult> predicate2 = canCloseFunc;
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command1_2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
                {
                    Text = "OK", Result = System.Windows.Forms.DialogResult.OK
                };
                action2.Commands.Add(command1_2);
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties properties2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties();
                properties2.ButtonSize = new Size(100, 40);
                properties2.Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox;
                DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this, action2, properties2, predicate2);
                return;
            }
            if (isBookmarked)
            {
                res = mainProc.removeFromBookmark(curNode.Text);
                if (res)
                {
                    isBookmarked = false;
                    if (light == 0)
                    {
                        button4.ImageIndex = 2;
                    }
                    else if (light == 1)
                    {
                        button4.ImageIndex = 3;
                    }
                }
            }
            else
            {
                res = mainProc.addToBookmark(curNode.Text);
                {
                    isBookmarked = true;
                    if (light == 0)
                    {
                        button4.ImageIndex = 0;
                    }
                    else if (light == 1)
                    {
                        button4.ImageIndex = 1;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void Button27_Click(object sender, EventArgs e)
        {
            //Save button
            bool   res;
            string resultMessage = "Lỗi không xác định xảy ra";

            if (textBox8.Enabled == false)
            {
                //save edited entry
                res = mainProc.saveWord(textBox8.Text, textBox30.Text, textBox7.Text, richTextBox5.Text, richTextBox6.Text, textBox8.Text);
            }
            else
            {
                //save new entry
                res = mainProc.saveWord(textBox8.Text, textBox30.Text, textBox7.Text, richTextBox5.Text, richTextBox6.Text);
            }

            if (res == true)
            {
                resultMessage = "Lưu từ vựng thành công";
            }
            else
            {
                resultMessage = "Lưu từ vựng không thành công";
            }

            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction action = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
            {
                Caption = "Thông báo", Description = resultMessage
            };
            Predicate <DialogResult> predicate = canCloseFunc;

            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
            {
                Text = "OK", Result = System.Windows.Forms.DialogResult.OK
            };
            action.Commands.Add(command1);
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties properties = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties();
            properties.ButtonSize = new Size(100, 40);
            properties.Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox;
            DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this, action, properties, predicate);

            if (textBox8.Enabled == false)
            {
                reloadMeaningPanel();
            }
            flyoutPanel5.HidePopup();

            textBox30.Text = "";

            this.Activate();
        }
Ejemplo n.º 5
0
        private void Button9_Click(object sender, EventArgs e)
        {
            //delete collection
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction action = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
            {
                Caption = "Xác nhận", Description = "Bạn muốn xóa bộ sưu tập này??"
            };
            Predicate <DialogResult> predicate = canCloseFunc;

            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
            {
                Text = "Có", Result = System.Windows.Forms.DialogResult.Yes
            };
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
            {
                Text = "Không", Result = System.Windows.Forms.DialogResult.No
            };
            action.Commands.Add(command1);
            action.Commands.Add(command2);
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties properties = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties();
            properties.ButtonSize = new Size(100, 40);
            properties.Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox;
            if (DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this, action, properties, predicate) == System.Windows.Forms.DialogResult.Yes)
            {
                mainProc.removeCollection(tempSelectCollection);
                listView7.Items.Clear();
                tempSelectCollection = "";
                listView2.Items.Clear();
                listView6.Items.Clear();
                ListViewItem listAllItem = new ListViewItem(new string[] { "Tất cả các từ" }, 0, System.Drawing.SystemColors.Window, System.Drawing.Color.Empty, null);
                listAllItem.Tag = "control";
                listView2.Items.Add(listAllItem);
                List <string> colList = mainProc.collectionListing();
                if (colList.Count > 0)
                {
                    foreach (var entry in colList)
                    {
                        ListViewItem newlistviewitem = new ListViewItem(new string[] { entry }, 0, System.Drawing.SystemColors.Window, System.Drawing.Color.Empty, null);
                        newlistviewitem.Tag       = "control";
                        newlistviewitem.ForeColor = forecolor;
                        newlistviewitem.BackColor = backcolor;
                        listView2.Items.Add(newlistviewitem);
                        ListViewItem newlistviewitem2 = new ListViewItem(new string[] { entry }, 0, System.Drawing.SystemColors.Window, System.Drawing.Color.Empty, null);
                        newlistviewitem2.Tag       = "control";
                        newlistviewitem2.ForeColor = forecolor;
                        newlistviewitem2.BackColor = backcolor;
                        listView6.Items.Add(newlistviewitem2);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        void ViewForm_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
        {
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
            {
                Text = "确定", Result = System.Windows.Forms.DialogResult.Yes
            };
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
            {
                Text = "取消", Result = System.Windows.Forms.DialogResult.No
            };
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction action = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
            {
                Description = "确认退出软件?"
            };

            action.Commands.Add(command1);
            action.Commands.Add(command2);

            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties properties = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties()
            {
                ButtonSize = new System.Drawing.Size(100, 35),
                Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox
            };

            Predicate <System.Windows.Forms.DialogResult> predicate = canCloseFunc;

            if (DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this.m_view.ViewForm, action, properties, predicate) == System.Windows.Forms.DialogResult.No)
            {
                e.Cancel = true;
            }
            else
            {
                e.Cancel = false;
                this.CloseChildren();
                Configure.AppSettings.SaveSkinName(this.m_view.DefaultLookAndFeel.LookAndFeel.SkinName);
            }
        }
Ejemplo n.º 7
0
        private bool OnExit()
        {
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
            {
                Text = "确定", Result = System.Windows.Forms.DialogResult.Yes
            };
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
            {
                Text = "取消", Result = System.Windows.Forms.DialogResult.No
            };
            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction action = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
            {
                Description = "退出软件?"
            };

            action.Commands.Add(command1);
            action.Commands.Add(command2);

            DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties properties = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties()
            {
                ButtonSize = new System.Drawing.Size(100, 35),
                Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox
            };

            Predicate <System.Windows.Forms.DialogResult> predicate = canCloseFunc;

            if (DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this.m_view.ViewForm, action, properties, predicate) == System.Windows.Forms.DialogResult.No)
            {
                return(false);
            }
            else
            {
                CloseChildren();
                return(true);
            }
        }
Ejemplo n.º 8
0
        private void Button24_Click(object sender, EventArgs e)
        {
            //delete word (permanent or from collection - context based)


            if (curNode == null)
            {
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction action2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
                {
                    Caption = "Thông báo", Description = "Xin hãy chọn từ trước khi xóa"
                };
                Predicate <DialogResult> predicate2 = canCloseFunc;
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command1_2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
                {
                    Text = "OK", Result = System.Windows.Forms.DialogResult.OK
                };
                action2.Commands.Add(command1_2);
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties properties2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties();
                properties2.ButtonSize = new Size(100, 40);
                properties2.Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox;
                DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this, action2, properties2, predicate2);
                return;
            }
            if (selectCollection != "")
            {
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction col_action = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
                {
                    Caption = "Xác nhận", Description = "Bạn muốn xóa từ này ra khỏi bộ sưu tập?"
                };
                Predicate <DialogResult> col_predicate = canCloseFunc;
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand col_command1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
                {
                    Text = "Có", Result = System.Windows.Forms.DialogResult.Yes
                };
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand col_command2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
                {
                    Text = "Không", Result = System.Windows.Forms.DialogResult.No
                };
                col_action.Commands.Add(col_command1);
                col_action.Commands.Add(col_command2);
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties col_properties = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties();
                col_properties.ButtonSize = new Size(100, 40);
                col_properties.Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox;
                if (DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this, col_action, col_properties, col_predicate) == System.Windows.Forms.DialogResult.Yes)
                {
                    mainProc.removeFromCollection(curNode.Text, selectCollection);
                    onSearch();
                }
            }
            else
            {
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction action = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutAction()
                {
                    Caption = "Xác nhận", Description = "Bạn muốn xóa từ này vĩnh viễn??"
                };
                Predicate <DialogResult> predicate = canCloseFunc;
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command1 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
                {
                    Text = "Có", Result = System.Windows.Forms.DialogResult.Yes
                };
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand command2 = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutCommand()
                {
                    Text = "Không", Result = System.Windows.Forms.DialogResult.No
                };
                action.Commands.Add(command1);
                action.Commands.Add(command2);
                DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties properties = new DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutProperties();
                properties.ButtonSize = new Size(100, 40);
                properties.Style      = DevExpress.XtraBars.Docking2010.Views.WindowsUI.FlyoutStyle.MessageBox;
                if (DevExpress.XtraBars.Docking2010.Customization.FlyoutDialog.Show(this, action, properties, predicate) == System.Windows.Forms.DialogResult.Yes)
                {
                    mainProc.removeWord(curNode.Text);
                    onSearch();
                }
            }
        }