Ejemplo n.º 1
0
        public ChooseDate(ApproxDate approxDate)
        {
            InitializeComponent();

            if (approxDate == null)
            {
                return;
            }

            if (approxDate.Unknown)
            {
                rbtUnknown.Checked = true;
            }
            else if (approxDate.Year >= 0)
            {
                rbtYear.Checked = true;
                txtYear.Text    = approxDate.Year.ToString();
                chbYear.Checked = !approxDate.AD;
            }
            else if (approxDate.Century >= 0)
            {
                rbtCentury.Checked = true;
                txtCentury.Text    = approxDate.Century.ToString();
                chbCentury.Checked = !approxDate.AD;
            }
        }
        private void btnDate_Click(object sender, EventArgs e)
        {
            ChooseDate cd = new ChooseDate(approxDate);

            cd.ShowDialog();

            if (cd.DialogResult == DialogResult.OK)
            {
                approxDate         = cd.getApproxDate();
                lblApproxDate.Text = approxDate.ToString();
            }
        }
Ejemplo n.º 3
0
        public ResourcesFilterForm()
        {
            InitializeComponent();

            resources = MainForm.resources.Values.ToList();

            cmbUnit.DropDownStyle      = ComboBoxStyle.DropDownList;
            cmbFrequency.DropDownStyle = ComboBoxStyle.DropDownList;

            this.cmbType.DropDownStyle = ComboBoxStyle.DropDownList;
            foreach (Type t in MainForm.types.Values)
            {
                cmbType.Items.Add(t.SecondID);
            }

            chbID_CheckedChanged(this, EventArgs.Empty);
            chbName_CheckedChanged(this, EventArgs.Empty);
            chbDate_CheckedChanged(this, EventArgs.Empty);
            chbImportant_CheckedChanged(this, EventArgs.Empty);
            chbRenewable_CheckedChanged(this, EventArgs.Empty);
            chbUnit_CheckedChanged(this, EventArgs.Empty);
            chbFrequency_CheckedChanged(this, EventArgs.Empty);
            chbCost_CheckedChanged(this, EventArgs.Empty);
            chbType_CheckedChanged(this, EventArgs.Empty);
            chbTags_CheckedChanged(this, EventArgs.Empty);

            rbtDateMin1.Checked = true;
            rbtDateMax1.Checked = true;
            rbtDateMin1_CheckedChanged(this, EventArgs.Empty);
            rbtDateMin1_CheckedChanged(this, EventArgs.Empty);

            rxCentury = new Regex("^[1-9][0-9]*\\.vek[ ](p\\.)?n\\.e\\.$");
            rxYear    = new Regex("^[1-9][0-9]*\\.g\\.[ ](p\\.)?n\\.e\\.$");

            approxDateMax = new ApproxDate();
            approxDateMin = new ApproxDate();
        }
 private void dateTimePicker_ValueChanged(object sender, EventArgs e)
 {
     approxDate         = null;
     lblApproxDate.Text = "";
 }
        public EditResourceForm(Resource res)
        {
            InitializeComponent();
            ofd.Filter = "Image Files(*.BMP;*.JPG;*.PNG)|*.BMP;*.JPG;*.PNG";
            this.cmbUnit.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cmbType.DropDownStyle = ComboBoxStyle.DropDownList;

            tags = res.Tags;
            type = res.Type;

            txtId.Text          = res.ID;
            txtId.ReadOnly      = true;
            txtName.Text        = res.Name;
            txtDescription.Text = res.Description;
            lblIconName.Text    = res.IconFileName;
            if (res.Renewable)
            {
                chbRenewable.Checked = true;
            }
            if (res.Important)
            {
                chbImportant.Checked = true;
            }
            if (res.Exploatable)
            {
                chbExploatable.Checked = true;
            }
            cmbUnit.Text = Resource.UnitToString(res.Unit);
            switch (res.Frequency)
            {
            case Frequency.FREQUENT:
                rbtFrequent.Checked = true;
                break;

            case Frequency.RARE:
                rbtRare.Checked = true;
                break;

            case Frequency.UNIVERSAL:
                rbtUniversal.Checked = true;
                break;
            }
            txtCost.Text         = res.Cost.ToString();
            dateTimePicker.Value = res.Discovered;
            lblTag.Text          = res.Tags.Count.ToString();
            fullFileName         = res.IconFileName;
            lblIconName.Text     = fullFileName;
            if (res.ApproxDiscovered != null)
            {
                approxDate         = res.ApproxDiscovered;
                lblApproxDate.Text = res.ApproxDiscovered.ToString();
            }


            foreach (Type t in MainForm.types.Values)
            {
                cmbType.Items.Add(t.ID);
            }
            cmbType.SelectedItem = res.Type.ID;

            ToolTip tt = new ToolTip();

            tt.SetToolTip(btnDate, "Izbor okvirnog datuma");

            lblApproxDate.Enabled  = rbtApproxDate.Checked;
            btnDate.Enabled        = rbtApproxDate.Checked;
            dateTimePicker.Enabled = rbtDate.Checked;
        }