Ejemplo n.º 1
0
 /// <summary>
 /// Deletes selected set folder physically and rerenders the set list
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnBtnDelMainClickEventRaised(object sender, EventArgs e)
 {
     if (SetModel.SelectedSet != null)
     {
         DeleteSet.Delete(SetModel.SelectedSet);
         _setModels = StaticFactory.CreateAllSets(); //Renew all set list
         SetListboxInit();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Open set rename dialog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnRenameBtnClickEventRaised(object sender, EventArgs e)
        {
            //TODO: Check why SetListbox doesn't update after renaming set
            if (SetModel.SelectedSet != null)
            {
                //Check for illegal characters
                SetNameUpdater _setNameUpdater = StaticFactory.CreateSetNameUpdater();

                _setNameUpdater.inputNewSetTitle.TextChanged += (o, a) =>
                {
                    string illegalChars = "^[\\w ]+$";
                    Regex  regex        = new Regex(illegalChars);

                    if (_setNameUpdater.inputNewSetTitle.Text == "" || !regex.IsMatch(_setNameUpdater.inputNewSetTitle.Text))
                    {
                        _setNameUpdater.SetNameUpdaterBtnSubmit.Visible = false;
                        _setNameUpdater.WarningLabel.Visible            = true;
                    }
                    else
                    {
                        _setNameUpdater.SetNameUpdaterBtnSubmit.Visible = true;
                        _setNameUpdater.WarningLabel.Visible            = false;
                    }
                };


                //Create setNameUpdater window &
                _setNameUpdater.StartPosition = FormStartPosition.Manual;
                _setNameUpdater.Location      = new System.Drawing.Point(this._mainView.Location.X + 430, this._mainView.Location.Y + 400);

                DialogResult updateDialog = _setNameUpdater.ShowDialog(_mainView);


                //If submit btn = pressed, rename set folder name
                if (updateDialog == DialogResult.OK)
                {
                    if (_setlistboxPresenter._setlistboxView.HomeSetList.SelectedItem != null)
                    {
                        //Rename set folder name
                        UpdateSet.Update(_setlistboxPresenter._setlistboxView.HomeSetList.SelectedItem.Text, _setNameUpdater.inputNewSetTitle.Text);

                        //Rebuild setlistbox item list
                        _setlistboxPresenter._setlistboxView.HomeSetList.Items.Clear();
                        _setModels = StaticFactory.CreateAllSets();
                        SetListboxInit();
                        _setlistboxPresenter._setlistboxView.HomeSetList.SelectedIndex = 0;
                    }
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Reinitialize SetListbox
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnAddSetViewSubmitClicked(object sender, EventArgs e)
 {
     _setModels = StaticFactory.CreateAllSets(); //Renew all set list
     SetListboxInit();
 }