Esempio n. 1
0
        private void miReplace_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count < 1)
            {
                return;
            }

#if !NOCATCH
            try {
#endif
            ReplaceForm rpf = new ReplaceForm();
            foreach (ListViewItem li in listView1.SelectedItems)
            {
                rpf.AddRabbit((li.Tag as AdultRabbit).ID);
            }
            if (rpf.ShowDialog() == DialogResult.OK && !MainForm.MustClose)
            {
                _rsb.Run();
            }
#if !NOCATCH
        }

        catch (Exception exc) {
            MessageBox.Show(exc.Message);
            _logger.Warn(exc);
            _rsb.Run();
        }
#endif
        }
Esempio n. 2
0
        private void replaceMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count < 1)
            {
                return;
            }

            Building    b  = null;
            ReplaceForm rf = new ReplaceForm();

            foreach (ListViewItem li in listView1.SelectedItems)
            {
                Building b2 = li.Tag as Building;
                if (b2 != b)
                {
                    b = b2;
                    for (int i = 0; i < b.Sections; i++)
                    {
                        if (b.Busy[i].ID > 0)
                        {
                            rf.AddRabbit(b.Busy[i].ID);
                        }
                    }
                }
            }
            if (rf.ShowDialog() == DialogResult.OK)
            {
                _rsb.Run();
            }
        }
Esempio n. 3
0
        public void ExecReplace()
        {
            string selt = CurrentSyntaxEditor.SelectedText;

            if (selt != string.Empty)
            {
                ReplaceForm.tbTextToFind.Text = selt;
            }
            ReplaceForm.Show();
        }
Esempio n. 4
0
        public MainForm()
        {
            InitializeComponent();
            CommonFunction.RegisterMarkTargetDelegate(MarkTargetLine);
            ReplaceForm.RegisterReplaceTargetDelegate(ReplaceTarget);
            GoToForm.RegisterGoToLineDelegate(GoToLine);
            EncryptForm.RegisterEncryptDelegate(EncryptText);
            FontForm.RegisterFontDelegate(ChangeFont);
            ColorForm.RegisterColorDelegate(ChangeColor);

            ContextMenuStrip cms = new ContextMenuStrip();

            ToolStripMenuItem undo = new ToolStripMenuItem("Undo");

            undo.Name   = undo.Text;
            undo.Click += new EventHandler(toolStrip_Undo_Click);
            cms.Items.Add(undo);
            ToolStripMenuItem redo = new ToolStripMenuItem("Redo");

            redo.Name   = redo.Text;
            redo.Click += new EventHandler(toolStrip_Redo_Click);
            cms.Items.Add(redo);
            cms.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem cut = new ToolStripMenuItem("Cut");

            cut.Name   = cut.Text;
            cut.Click += new EventHandler(toolStrip_Cut_Click);
            cms.Items.Add(cut);
            ToolStripMenuItem copy = new ToolStripMenuItem("Copy");

            copy.Name   = copy.Text;
            copy.Click += new EventHandler(toolStrip_Copy_Click);
            cms.Items.Add(copy);
            ToolStripMenuItem paste = new ToolStripMenuItem("Paste");

            paste.Name   = paste.Text;
            paste.Click += new EventHandler(toolStrip_Paste_Click);
            cms.Items.Add(paste);
            cms.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem selectAll = new ToolStripMenuItem("Select All");

            selectAll.Name   = selectAll.Text;
            selectAll.Click += new EventHandler(toolStrip_SelectAll_Click);
            cms.Items.Add(selectAll);

            cms.Opening += new CancelEventHandler(ContextMenuStrip_Opening);
            customRtb.ContextMenuStrip = cms;
        }
Esempio n. 5
0
        private static void Main(string[] args)
        {
            // Configuration dirs
            string basePath;

            basePath  = Directory.GetCurrentDirectory() + "\\";
            wikiConf  = new WikiConf();
            wiki      = new WikiMedia(wikiConf.wikiURL, wikiConf.wikiDomain, wikiConf.wikiDefCategory);
            contatti  = new ContactsHelper(wiki);
            converter = new Model2PowerPoint(wiki, basePath, basePath + wikiConf.pptTemplate);
            string[] extNames = Directory.GetFiles(basePath + wikiConf.extractors);
            extractors = new SummaryBuilder[extNames.Length];
            for (int i = 0; i < extNames.Length; i++)
            {
                extractors[i] = new ExtractSummary(converter, extNames[i]);
            }
            string[] lines;
            if (File.Exists(wikiConf.loginConf) == true)
            {
                lines = File.ReadAllLines(wikiConf.loginConf, Encoding.UTF8);
            }
            else
            {
                lines = new string[2] {
                    null, null
                };
            }
            //GUI Init
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            wikiLoginForm  = new WikiLoginForm(wiki, lines[0], lines[1]);
            mainForm       = new MainForm(wiki, wikiConf);
            categoryExport = new CategoryExport(wiki, converter, extractors);
            categoryExport.SetCategories(wikiConf.categories);
            addressBookExport = new AddressBookExport(wiki, contatti);
            addressBookExport.SetCategories(wikiConf.categories);
            pageExport      = new PageExport(wiki, converter);
            replaceForm     = new ReplaceForm(wikiConf);
            createForm      = new CreateForm(wikiConf);
            pageProcessForm = new PageProcess(wikiConf, wiki);
            //GO
            Application.Run(mainForm);
        }
Esempio n. 6
0
        private void miBoysOut_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count != 1)
            {
                return;
            }

            try {
                ReplaceForm rpf = new ReplaceForm();
                rpf.AddRabbit((listView1.SelectedItems[0].Tag as AdultRabbit).ID);
                rpf.SetAction(ReplaceForm.Action.BOYSOUT);
                if (rpf.ShowDialog() == DialogResult.OK && !MainForm.MustClose)
                {
                    _rsb.Run();
                }
            } catch (Exception exc) {
                MessageBox.Show(exc.Message);
                _logger.Warn(exc);
                _rsb.Run();
            }
        }
Esempio n. 7
0
        public override void Execute(TextBoxControl editor)
        {
            if (_dlgReplace == null)
            {
                _dlgReplace = new ReplaceForm(editor);
            }

            if (!_dlgReplace.Visible)
            {
                _dlgReplace.Show();
            }

            //TextLocation homeLocation = editor.GetLineHomeInfo(editor.Caret.Line);
            //if (homeLocation != TextLocation.Empty)
            //{
            //    editor.Caret.Position = homeLocation;
            //    editor.Caret.UpdateCaretPosition();
            //    if (editor.HorizontalScroll.Value != 0 && editor.HorizontalScroll.Visible)
            //    {
            //        editor.HorizontalScroll.Value = 0;
            //        editor.PerformLayout();
            //    }
            //}
        }
		public void Replace()
		{
			using (var form = new ReplaceForm())
			{
				if (form.ShowDialog(this) == DialogResult.OK)
				{
					int count;
					using (new WaitCursor(this, WaitCursorOption.ShortSleep))
					{
						count = replaceAll(form.TextToFind, form.TextToReplaceWith);
					}

					if (count <= 0)
					{
						XtraMessageBox.Show(
							"The text was not found.",
							@"Zeta Resource Editor",
							MessageBoxButtons.OK,
							MessageBoxIcon.Information);
					}
					else
					{
						XtraMessageBox.Show(
							string.Format(
								"{0} occurrences have been replaced.",
								count),
							@"Zeta Resource Editor",
							MessageBoxButtons.OK,
							MessageBoxIcon.Information);
					}
				}
			}
		}
        /// <summary>
        /// Shows replace dialog
        /// </summary>
        public static void ShowReplaceDialog(FastColoredTextBox textbox, string findText = null)
        {
            if (textbox.ReadOnly)
                return;

            ReplaceForm replaceForm = textbox.replaceForm;
            if (replaceForm == null)
                replaceForm = new ReplaceForm(textbox);

            if (findText != null)
            {
                replaceForm.tbFind.Text = findText;
            }
            else if (!textbox.Selection.IsEmpty && textbox.Selection.Start.iLine == textbox.Selection.End.iLine)
            {
                replaceForm.tbFind.Text = textbox.Selection.Text;
            }

            replaceForm.tbFind.SelectAll();
            replaceForm.Show();
        }
Esempio n. 10
0
        private DialogResult performJob(ZootehJob job, ref bool needUpdate)
        {
            DialogResult res = DialogResult.OK;

            switch (job.Type)
            {
            case JobType.NestOut:
                RabNetEngBuilding b = Engine.get().getBuilding(job.ID);
                b.setNest(false, (job.ID2 == 0 ? 0 : 1));
                needUpdate = false;
                break;

            case JobType.PreOkrol:
                Engine.get().preOkrol(job.ID);
                //_fullUpdate = false;
                break;

            case JobType.BoysOut:
            case JobType.GirlsOut:
                ReplaceForm rf = new ReplaceForm();
                rf.AddRabbit(job.ID);
                if (job.Type == JobType.BoysOut)
                {
                    rf.SetAction(ReplaceForm.Action.BOYSOUT);
                }
                res = rf.ShowDialog();
                break;

            case JobType.CountKids:
                RabNetEngRabbit rrr = Engine.get().getRabbit(job.ID);
                CountKids       ck  = new CountKids(job.ID);
                int             id2 = 0;
                for (int i = 0; i < rrr.Youngers.Count; i++)
                {
                    if (rrr.Youngers[i].ID == job.ID2)
                    {
                        id2 = i;
                    }
                }
                if (_makeFlag == 0)
                {
                    //rrr.CountKids(0, 0, 0, rrr.Youngers[id2].Group, rrr.Youngers[id2].Age, 0);
                    ck.MakeCount();
                    ck.Dispose();
                    needUpdate = false;
                }
                else
                {
                    //ck = new CountKids(job.ID, job.Flag == 1);
                    //ck.SetGroup(id2);
                    res = ck.ShowDialog();
                }
                break;

            case JobType.F**k:
                int id = job.ID;
                if (_makeFlag == -1)
                {
                    needUpdate = false;
                    Engine.db().SetRabbitVaccine(id, Vaccine.V_ID_LUST);
                    res = DialogResult.OK;
                    break;
                }

                if (job.Flag > 1)
                {
                    id = 0;
                    ReplaceBrideForm rb = new ReplaceBrideForm(job.ID);
                    res = rb.ShowDialog();
                    if (res == DialogResult.OK)
                    {
                        id = rb.getGirlOut();
                    }
                    res = DialogResult.Cancel;
                }
                if (id != 0)
                {
                    res = (new FuckForm(id)).ShowDialog();
                }
                break;

            case JobType.Okrol:
                res = (new OkrolForm(job.ID)).ShowDialog();
                break;

            case JobType.Vaccine:    //прививка
                RabNetEngRabbit rab = Engine.get().getRabbit(job.ID);
                AddRabVacForm   dlg = new AddRabVacForm(rab, false, job.ID2);
                res = dlg.ShowDialog();
                if (res == DialogResult.OK)
                {
                    rab.SetVaccine(dlg.VacID, dlg.VacDate, false);
                    if (rab.ParentID != 0 && Engine.opt().getBoolOption(Options.OPT_ID.VACC_MOTHER))
                    {
                        RabNetEngRabbit r2 = Engine.get().getRabbit(rab.ParentID);
                        r2.SetVaccine(dlg.VacID, dlg.VacDate, false);
                    }
                }
                needUpdate = false;
                break;

            case JobType.NestSet:    //установка гнездовья
                RabPlace rp = RabPlace.Parse(job.Rabplace);
                if (rp.CanHaveNest())
                {
                    RabNetEngBuilding rbe = RabNetEngBuilding.FromPlace(job.Rabplace, Engine.get());
                    rbe.setNest(true, rp.Section);
                    res        = DialogResult.OK;
                    needUpdate = false;
                    break;
                }
                ReplaceForm f = new ReplaceForm();
                f.AddRabbit(job.ID);
                f.SetAction(ReplaceForm.Action.SET_NEST);
                res = f.ShowDialog();
                break;

            case JobType.BoysByOne:
                f = new ReplaceForm();
                f.AddRabbit(job.ID);
                res = f.ShowDialog();
                break;

            case JobType.SpermTake:
                RabNetEngRabbit r = Engine.get().getRabbit(job.ID);
                r.SpermTake();
                needUpdate = false;
                break;
            }

            return(res);
        }