Пример #1
0
 private void categories_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {                       
     if (categories.Items[e.Item].Text != "" && e.Label == null) return;
     string label = null;
     if (e.Label != null) label = e.Label.Trim();
     if (e.Label == null || e.Label == "")
     {
         if (add_mode)
         {
             source.RemoveAt(selected_cat);
             categories.Items.RemoveAt(categories.Items.Count - 1);
             add_mode = false;
         }
         else
         {
             MessageBox.Show("Name can not be Empty!");
             e.CancelEdit = true;
         }
     }
     else
     {
         source[selected_cat].name = label;
         if (add_mode)
         {
             add_mode = false;
             selected_cat = -1;
             categories.SelectedIndices.Clear();
             categories.SelectedIndices.Add(categories.Items.Count - 1);
             select_category();
         }
     }
 }
        private void algoListView_BeforeLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            string        algorithmName = SelectedAlgorithmName();
            CoinAlgorithm algorithm     = MinerFactory.Instance.GetAlgorithm(algorithmName);

            e.CancelEdit = algorithm.BuiltIn;
        }
Пример #3
0
 private void m_lsvTemplateAndValue_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     if (e.Label != null)
     {
         m_mthModify(e.Label.ToString().Trim());
     }
 }
Пример #4
0
        /// <summary>
        /// A file/directory item has been renamed
        /// </summary>
        private void FileViewAfterLabelEdit(Object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            ListViewItem item = null;

            try
            {
                if (e.CancelEdit || (e.Label == null) || (e.Label.Length == 0) || (e.Label == this.previousItemLabel))
                {
                    e.CancelEdit = true;
                    return;
                }
                item = this.fileView.Items[e.Item];
                String   file = item.Tag.ToString();
                FileInfo info = new FileInfo(file);
                String   path = info.Directory + Path.DirectorySeparatorChar.ToString();
                if (File.Exists(file))
                {
                    File.Move(path + this.previousItemLabel, path + e.Label);
                    DocumentManager.MoveDocuments(path + this.previousItemLabel, path + e.Label);
                }
                else if (Directory.Exists(path))
                {
                    Directory.Move(path + this.previousItemLabel, path + e.Label);
                    DocumentManager.MoveDocuments(path + this.previousItemLabel, path + e.Label);
                }
            }
            catch (Exception ex)
            {
                if (item != null)
                {
                    ErrorManager.ShowError(ex);
                }
                e.CancelEdit = true;
            }
        }
Пример #5
0
        //<Snippet1>
        private void MyListView_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            // Determine if label is changed by checking for null.
            if (e.Label == null)
            {
                return;
            }

            // ASCIIEncoding is used to determine if a number character has been entered.
            ASCIIEncoding AE = new ASCIIEncoding();

            // Convert the new label to a character array.
            char[] temp = e.Label.ToCharArray();

            // Check each character in the new label to determine if it is a number.
            for (int x = 0; x < temp.Length; x++)
            {
                // Encode the character from the character array to its ASCII code.
                byte[] bc = AE.GetBytes(temp[x].ToString());

                // Determine if the ASCII code is within the valid range of numerical values.
                if (bc[0] > 47 && bc[0] < 58)
                {
                    // Cancel the event and return the lable to its original state.
                    e.CancelEdit = true;
                    // Display a MessageBox alerting the user that numbers are not allowed.
                    MessageBox.Show("The text for the item cannot contain numerical values.");
                    // Break out of the loop and exit.
                    return;
                }
            }
        }
Пример #6
0
 private void listViewUnitGroups_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     if (e.Label != null && e.Label != "")
     {
         ((UnitGroup)listViewUnitGroups.Items[e.Item].Tag).Name = e.Label;
     }
 }
		private void ArgumentsList_BeforeLabelEdit(object sender, LabelEditEventArgs e)
		{
			if(e.Item == ArgumentsList.Items.Count - 1)
			{
				e.CancelEdit = true;
			}
		}
 private void OnAfterLabelEdit(object sender, SWF.LabelEditEventArgs args)
 {
     if (viewItem.ListView.Items.IndexOf(viewItem) == args.Item)
     {
         newText = args.Label;
         RaiseAutomationPropertyChangedEvent();
     }
 }
 private void OnUIASubItemTextChanged(object sender, SWF.LabelEditEventArgs args)
 {
     if (args.Item == 0)
     {
         newText = viewItem.Text;
         RaiseAutomationPropertyChangedEvent();
     }
 }
Пример #10
0
        private void lstv_BeforeLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            // We do this so the user can press the del key while in label editing mode
            // without it being intercepted by the context menu and used to delete the
            // entire Strip

            lstv.ContextMenu = null;
        }
Пример #11
0
 private void listView_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (treeView.SelectedNode.Level == 0)
     {
         //SelectedAlbum[e.Item].Name = e.Label;
         //FillTreeView();//TODO: Mejorar esto
     }
 }
Пример #12
0
 private void lvwCategories_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (e.Label == string.Empty)
     {
         e.CancelEdit = true;
     }
     PopulateListView();
 }
		private void ArgumentsList_AfterLabelEdit(object sender, LabelEditEventArgs e)
		{
			if((e.Label == null && ArgumentsList.Items[e.Item].Text.Length == 0) || (e.Label != null && e.Label.Trim().Length == 0))
			{
				e.CancelEdit = true;
				ArgumentsList.Items.RemoveAt(e.Item);
			}
		}
Пример #14
0
 private void OnUIATextChanged(object sender, SWF.LabelEditEventArgs args)
 {
     if (args.Item == editProvider.ItemProvider.ListView.Columns.IndexOf(editProvider.ColumnHeader))
     {
         newText = (string)editProvider.GetPropertyValue(ValuePatternIdentifiers.ValueProperty.Id);
         RaiseAutomationPropertyChangedEvent();
     }
 }
 void listView_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (e.Label != null)
     {
         assemblyListManager.Rename(listView.Items[e.Item].Text, e.Label);
         assemblyListManager.CurrentListName = e.Label;
     }
 }
Пример #16
0
 private void lvRepositories_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     if (e.Label == "")
     {
         Utils.ShowMessageBoxExclamation("You must specify a name for this repository", "Missing Name");
         e.CancelEdit = true;
     }
 }
Пример #17
0
 void lvConnects_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     //throw new NotImplementedException();
     Data.Connect c=(Data.Connect)(lvConnects.Items[e.Item].Tag);
     if (e.Label != null)
     {
         c.Name = e.Label;
         propertyGrid1.SelectedObject = c;
     }
 }
Пример #18
0
 //<snippet1>
 private void ListView1_BeforeLabelEdit(object sender,
                                        System.Windows.Forms.LabelEditEventArgs e)
 {
     // Allow all but the first two items of the list to
     // be modified by the user.
     if (e.Item < 2)
     {
         e.CancelEdit = true;
     }
 }
Пример #19
0
		internal void OnUIASubItemTextChanged (LabelEditEventArgs args)
		{
			//If our index is 0 we also generate TextChanged for the ListViewItem
			//because ListViewItem.Text is the same as ListViewItem.SubItems [0].Text
			if (args.Item == 0)
				OnUIATextChanged ();

			if (UIASubItemTextChanged != null)
				UIASubItemTextChanged (this, args);
		}
Пример #20
0
        private void LvConnections_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            if (!e.CancelEdit)
            {
                var detail = (ConnectionDetail)lvConnections.Items[e.Item].Tag;
                detail.ConnectionName = e.Label;

                ConnectionManager.Instance.SaveConnectionsFile();
            }
        }
Пример #21
0
        private void algoListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (e.Label == null)
                //edit was canceled
                return;

            string algorithmName = SelectedAlgorithmName();
            CoinAlgorithm algorithm = MinerFactory.Instance.GetAlgorithm(algorithmName);
            algorithm.Name = e.Label;
            algorithm.FullName = e.Label;
        }
Пример #22
0
		//结束编辑组
		void lvUserGroup_AfterLabelEdit(object sender, LabelEditEventArgs e)
		{
			ListViewItem lvt = lvUserGroup.Items[e.Item];
			if (string.IsNullOrEmpty(e.Label) || e.Label == lvt.Text) { e.CancelEdit = true; return; }

			//编辑
			Cache.ControlCache.RemoveUserGroup(lvt.Text);
			Cache.ControlCache.UserGroupList.Add(e.Label);
			Env.ClientConfig.HostGroupConfig.Where(m => m.Value == lvt.Text).ToList().ForEach(m => Env.ClientConfig.HostGroupConfig[m.Key] = e.Label);
			lvt.Text = e.Label;
		}
Пример #23
0
        // Sort the collection by calling the Text property
        private void TreeListView_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            e.CancelEdit = true;
            if (e.Label == null || e.Label == "")
            {
                return;
            }
            TreeListViewItem item = (TreeListViewItem)base.Items[e.Item];

            item.Text = e.Label;
        }
Пример #24
0
        private void listView1_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            if (e.Label != null)
            {
                AIONode aionode = (AIONode)listView1.Items[e.Item].Tag;
                aionode.data.Name = e.Label;

                TreeNode node = (TreeNode)aionode.container;
                node.Text = e.Label;
            }
        }
Пример #25
0
        // Item Label Edit
        private void gamelist_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            Game g = gamelist.Items[e.Item].Tag as Game;

            if (IsEmpty(e.Label))
            {
                e.CancelEdit = true;
                return;
            }
            g.Name = e.Label;
            dirty  = true;
        }
Пример #26
0
 private void listView1_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     if (e.Label == null || e.Label.Length == 0)
     {
         e.CancelEdit = true;
     }
     else
     {
         ActiveRecordPropertyDescriptor desc = listView1.Items[e.Item].Tag as ActiveRecordPropertyDescriptor;
         desc.PropertyName = e.Label;
     }
 }
Пример #27
0
 private void oView_BeforeLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     if (_EditAttribute.Length > 0)
     {            //object is a class
         System.Reflection.PropertyInfo oPInf = oView.Items[e.Item].Tag.GetType().GetProperty(_EditAttribute);
         if (oView.Items[e.Item].SubItems[0].Text != (string)oPInf.GetValue(oView.Items[e.Item].Tag, null))
         {
             oView.Items[e.Item].SubItems[0].Text = (string)oPInf.GetValue(oView.Items[e.Item].Tag, null);
             SendKeys.Send(oView.Items[e.Item].SubItems[0].Text + "+{HOME}");
         }
     }
 }
 private void listCategories_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (listCategories.SelectedItems != null && listCategories.SelectedItems.Count > 0 && e.Label.Trim() != null)
     {
         if (Categories.Local.FirstOrDefault(c => c.Title == textAddCategory.Text.Trim()) == null)
             (listCategories.SelectedItems[0].Tag as Category).Title = e.Label.Trim();
         else
         {
             MessageBox.Show("Category name exist");
             e.CancelEdit = true;
         }
     }
 }
Пример #29
0
 private void listView1_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     SqlConnection conn = new SqlConnection(login.sqlName);
     conn.Open();
     SqlCommand cmd = conn.CreateCommand();
     cmd.CommandText = "new_教师课程_课时修改名称";
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add("newName", SqlDbType.NVarChar).Value = e.Label.ToString();
     cmd.Parameters.Add("keshiID", SqlDbType.Int).Value = listView1.FocusedItem.Tag;
     cmd.ExecuteNonQuery();
     conn.Close();
     listView1.LabelEdit = false;
 }
        private void ProfilesListViewAfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            _renameInProcess = false;

            // If we cancel rename operation by hitting 'Esc' then label is null
            if (!string.IsNullOrEmpty(e.Label))
            {
                _settingsManager.RenameProfile(_originalProfileName, e.Label);

                // Reload profiles information
                PopulateProfilesList();
            }
        }
 private void paramListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (this.ViewableItem == null || e.Label == null) return;
      ListViewItem item = this.paramListView.Items[e.Item];
      string type = item.SubItems[2].Text;
      switch (type)
      {
     case "Single":
        float floatResult;
        if (float.TryParse(e.Label, NumberStyles.Any, CultureInfo.CurrentCulture, out floatResult))
        {
           ViewableItem.Parameters[e.Item] = floatResult;
           e.CancelEdit = false;
        }
        else
        {
           MessageBox.Show("Invalid entry, expecting a " + type, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error);
           e.CancelEdit = true;
        }
        break;
     case "Int32":
        int intResult;
        if (int.TryParse(e.Label, out intResult))
        {
           ViewableItem.Parameters[e.Item] = intResult;
           e.CancelEdit = false;
        }
        else
        {
           MessageBox.Show("Invalid entry, expecting a " + type, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error);
           e.CancelEdit = true;
        }
        break;
     case "Boolean":
        bool boolResult;
        if (bool.TryParse(e.Label, out boolResult))
        {
           ViewableItem.Parameters[e.Item] = boolResult;
           e.CancelEdit = false;
        }
        else
        {
           MessageBox.Show("Invalid entry, expecting a " + type, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error);
           e.CancelEdit = true;
        }
        break;
     default:
        break;
      }
 }
Пример #32
0
        private void listView1_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            ListViewItem item = listView1.SelectedItems[0];

            if (item.Tag is IAnalogOutput)
            {
                IAnalogOutput analogOut = (IAnalogOutput)item.Tag;
                if (e.Label != null)
                {
                    double newValue = Convert.ToDouble(e.Label);
                    analogOut.Set(newValue);
                }
            }
        }
Пример #33
0
 /// <summary>
 /// A file/directory item could be renamed
 /// </summary>
 private void FileViewBeforeLabelEdit(Object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     try
     {
         this.previousItemLabel = this.fileView.Items[e.Item].Text;
         if (this.previousItemLabel.StartsWith("["))
         {
             e.CancelEdit = true;
         }
     }
     catch
     {
         e.CancelEdit = true;
     }
 }
Пример #34
0
 private void lstNPCNames_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (e.Label == null) // User made no changes to the label text
     return;
     NPCInfo NI = this.lstNPCNames.Items[e.Item].Tag as NPCInfo;
       if (NI != null) {
       string NewName = e.Label;
     if (NewName.Length > 0x18) {
       NewName = NewName.Substring(0, 0x18);
       this.lstNPCNames.Items[e.Item].Text = NewName;
     }
     NameChange.Add(NI.ID, NI.Name, NewName);
     NI.Name = NewName;
       }
 }
Пример #35
0
        private void oView_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            System.Reflection.PropertyInfo oPInf = null;
            string sOldLabel = "";

            e.CancelEdit = true;            //cancel allways, let me control the changes

            //Get Old label
            if (_EditAttribute.Length > 0)
            {            //object is a class
                oPInf     = oView.Items[e.Item].Tag.GetType().GetProperty(_EditAttribute);
                sOldLabel = (string)oPInf.GetValue(oView.Items[e.Item].Tag, null);
            }
            else            //object is a string
            {
                sOldLabel = (string)oView.Items[e.Item].Tag;
            }

            // validate Label text. raise event onRowEdit
            ValidateEditedLabelArgs Mye = new ValidateEditedLabelArgs();

            Mye.Label = (e.Label == null || e.Label.Length == 0 ? sOldLabel : e.Label);
            Mye.Index = e.Item;
            onRowEdit(Mye);             //raise event

            //change the lable manualy (set the old value if case)
            oView.Items[e.Item].Text = Mye.Label;

            //if cancel then exit
            if (Mye.Cancel)
            {
                return;
            }


            //Upadate Object data Tag for the current Row
            if (_EditAttribute.Length > 0)
            {
                oPInf.SetValue(oView.Items[e.Item].Tag, (e.Label == null || e.Label.Length == 0 ?   sOldLabel       :       e.Label), null);                    //object is a class
            }
            else
            {
                oView.Items[e.Item].Tag = (e.Label == null || e.Label.Length == 0 ? sOldLabel       :       e.Label);                                   //object is a string
            }
            //Sort List
            oView.Sort();
        }
 private void listCategories_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     ListViewItem item = listCategories.Items[e.Item];
     if (item.Text != e.Label.Trim())
     {
         if (Global.DB.Categories.Local.SingleOrDefault(q => q.Title == e.Label.Trim()) == null)
         {
             (item.Tag as Category).Title = e.Label;
             if (CategoriesChanged != null)
                 CategoriesChanged.Invoke(this, null);
         }
         else
         {
             e.CancelEdit = true;
         }
     }
 }
Пример #37
0
 private void ListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (e.Label == null) {
         return;
     }
     foreach (ListViewItem item in this.listView.Items) {
         if (item.Index != e.Item && item.Text.Equals(e.Label)) {
             MessageBox.Show(Resources.ItemAlreadyExist, Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
             e.CancelEdit = true;
             return;
         }
     }
     FileInfo fileInfo = (FileInfo) this.listView.Items[e.Item].Tag;
     // Rename
     DoCommand.Exec("adb shell mv \"" + fileInfo.GetAbsoluteFilePath() + "\" " + "\"" + FileUtils.getParentDirPath(fileInfo.GetAbsoluteFilePath()) + "/" + e.Label + "\"");
     RefreshFileList();
 }
Пример #38
0
        private void ServerView_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            if (e.Label != null)
            {
                this.Cursor = Cursors.WaitCursor;

                string newfilename = e.Label;
                if (m_previousfilename == "New Folder")
                {
                    ftpc.DirCreate(newfilename);
                }
                else
                {
                    ftpc.Rename(m_previousfilename, newfilename);
                }
                ftpc.Dir();
            }
        }
Пример #39
0
 /**
  * A file/directory item could be renamed
  */
 public void FileViewBeforeLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     try
     {
         this.previousItemLabel = this.fileView.Items[e.Item].Text;
         if (this.previousItemLabel.StartsWith("["))
         {
             e.CancelEdit = true;
         }
         else
         {
             this.menuItemDel.Enabled = false;
         }
     }
     catch
     {
         e.CancelEdit = true;
     }
 }
Пример #40
0
        private void lstv_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            // Restore the context menu so the command keys, etc will work again

            lstv.ContextMenu = mnuListView;

            Strip stp = (Strip)lstv.Items[e.Item].Tag;

            // No change or an invalid change

            if (e.Label == null || e.Label == "")
            {
                e.CancelEdit = true;
                return;
            }

            stp.Name    = e.Label;
            m_doc.Dirty = true;
        }
Пример #41
0
        private void OnAfterLabelEdit(object sender, LabelEditEventArgs labelEditEventArgs)
        {
            m_newLabel = labelEditEventArgs.Label;
            for (int index = 0; index < m_tileBrushCollection.TileBrushes.Count; index++)
            {
                if (index == labelEditEventArgs.Item)
                    continue;
                if (m_newLabel == m_listView.Items[index].Text)
                {
                    labelEditEventArgs.CancelEdit = true;
                    m_duplicteIdMessageBox.Show();
                    return;
                }
            }

            TileBrush tileBrush = (TileBrush)m_listView.Items[labelEditEventArgs.Item].Tag;
            tileBrush.Id = labelEditEventArgs.Label;

            MarkAsModified();
        }
Пример #42
0
 protected override void OnAfterLabelEdit(LabelEditEventArgs e)
 {
     if (!((e.Label != null) && FileService.CheckFileName(e.Label)))
     {
         e.CancelEdit = true;
     }
     else
     {
         string fullName = ((FileListItem) base.Items[e.Item]).FullName;
         string newName = Path.Combine(Path.GetDirectoryName(fullName), e.Label);
         if (FileService.RenameFile(fullName, newName, false))
         {
             ((FileListItem) base.Items[e.Item]).FullName = newName;
         }
         else
         {
             e.CancelEdit = true;
         }
     }
 }
Пример #43
0
 private void listView1_AfterLabelEdit(object sender,LabelEditEventArgs e)
 {
     WidgetConnection = new OleDbConnection(ConnectString);//初始化一个数据库连接
     if(WidgetConnection.State == ConnectionState.Closed)//当数据库连接处于关闭状态时
     {
         WidgetConnection.Open();//打开数据库连接
     }
     if(e.Label != null && e.Label != "")//当选定项的文本内容存在且不为空时
     {
         string RefreshString = "update tb_WidgetApply set 产品名称='" //定义更新数据库字符串
             + e.Label + "' where 产品编号=" +
             (e.Item+1).ToString();
         OleDbCommand WidgetCommand = new OleDbCommand(//声明一个执行SQL语句的对象
             RefreshString,WidgetConnection);
         WidgetCommand.ExecuteNonQuery();//执行SQL语句
         WidgetConnection.Close();//关闭数据库连接
         MessageBox.Show("数据修改成功!","提示信息",//弹出信息提示
             MessageBoxButtons.OK,MessageBoxIcon.Asterisk);
     }
 }
Пример #44
0
 private void listCategory_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     try
      {
          renamedCategory = e.Label;
          if (renamedCategory != selectedCategory)
          {
              int curNote = listNote.SelectedItems.Count > 0 ? listNote.SelectedItems[0].Index : -1;
              RenameCategory();
              GetCategories();
              SelectCategory(listCategory.FindItemWithText(renamedCategory).Index);
              if(curNote >= 0)
                 SelectNote(curNote);
          }
      }
      catch (Exception ex)
      {
          Console.WriteLine(ex.ToString());
      }
 }
Пример #45
0
        private void lvCampos_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            ListViewItem lvi   = lvCampos.Items[e.Item];
            Field        field = (Field)lvi.Tag;

            if (!AliasValido(e.Label))
            {
                if (!(e.Label == null || e.Label == ""))
                {
                    e.CancelEdit = true;

                    MessageBox.Show("'" + e.Label + "' no es un alias válido");
                }
            }
            else
            {
                lvi.Text    = e.Label;
                field.Alias = lvi.Text;

                VerificaCamposCubiertos();
            }
        }
Пример #46
0
 private void listView_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     if (e.Label == null || e.Label.Length == 0)
     {
         e.CancelEdit = true;
         MessageBox.Show(this, "Picture name can't be empty", Program.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     else
     {
         LibraryListItem item = (LibraryListItem)this.listView.Items[e.Item];
         string          name = Path.Combine(Path.GetDirectoryName(item.Item.Path), e.Label + Path.GetExtension(item.Item.Path));
         try
         {
             File.Move(item.Item.Path, name);
             item.Item.Name = item.Text = e.Label;
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, "Failed to rename '" + Path.GetFileName(item.Item.Path) + "'\n\nSystem Error:\n" + ex.StackTrace, Program.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Пример #47
0
        //AfterLabelEditイベントハンドラ
        //アイテムのラベルの編集された時
        private void ListView1_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            ListView lv = (ListView)sender;
            //ラベルが変更されたか調べる
            //e.Labelがnullならば、変更されていない
            if (e.Label != null)
            {
                if(string.IsNullOrWhiteSpace(e.Label))
                {
                    e.CancelEdit = true;
                    return;
                }
                //同名のアイテムがあるか調べる
                foreach (ListViewItem lvi in lv.Items)
                    //同名のアイテムがあるときは編集をキャンセルする
                    if (lvi.Index != e.Item && lvi.Text == e.Label)
                    {
                        MessageBox.Show("同名のアイテムがすでにあります。");
                        //編集をキャンセルして元に戻す
                        e.CancelEdit = true;
                        return;
                    }
                
                //ここらへん追加部分  更新処理
                
                String sql = "update item_table set item_name = @afName where item_name=@bfName";
                SQLiteCommand cmd = new SQLiteCommand(sql, conn);
                //ネットには様々な入れ方があったがこの入れ方以外不発に終わったので今後はこのタイプを使用
                cmd.Parameters.Add(new SQLiteParameter("@afName", e.Label));
                cmd.Parameters.Add(new SQLiteParameter("@bfName", lv.SelectedItems[0].Text));

                updateExe(cmd);
                itemInListView(radio_income.Checked);
                 
            }
        }
Пример #48
0
        /**
         * A file/directory item has been renamed
         */
        public void FileViewAfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
        {
            this.menuItemDel.Enabled = true;
            ListViewItem item = null;

            try
            {
                // file / directory
                if (e.CancelEdit || (e.Label.Length == 0) || (e.Label == this.previousItemLabel))
                {
                    e.CancelEdit = true;
                    return;
                }
                item = this.fileView.Items[e.Item];
                string             file = (string)item.Tag;
                System.IO.FileInfo info = new System.IO.FileInfo(file);
                string             path = info.Directory + Path.DirectorySeparatorChar.ToString();
                // rename
                if (System.IO.File.Exists(file))
                {
                    System.IO.File.Move(path + this.previousItemLabel, path + e.Label);
                }
                else if (System.IO.Directory.Exists(file))
                {
                    System.IO.Directory.Move(path + this.previousItemLabel, path + e.Label);
                }
            }
            catch (Exception ex)
            {
                if (item != null)
                {
                    ErrorHandler.ShowError(ex.Message, ex);
                }
                e.CancelEdit = true;
            }
        }
Пример #49
0
 private void listView1_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     try
     {
         string MyPath = bc.Mpath() + "\\" + listView1.SelectedItems[0].Text;
         string newFilename = e.Label;
         string path2 = bc.Mpath() + "\\" + newFilename;
         if (File.Exists(MyPath))
         {
             if (MyPath != path2)
             {
                 File.Move(MyPath, path2);
             }
         }
         if (Directory.Exists(MyPath))
         {
             DirectoryInfo di = new DirectoryInfo(MyPath);
             di.MoveTo(path2);
         }
         listView1.Items.Clear();
         bc.GetListViewItem(bc.Mpath(), imageList1, listView1);
     }
     catch { }
 }
Пример #50
0
		protected override void OnBeforeLabelEdit (LabelEditEventArgs e)
		{
			FileViewListViewItem listViewItem = SelectedItems [0] as FileViewListViewItem;
			FSEntry fsEntry = listViewItem.FSEntry;

			// only allow editing of files or directories
			if (fsEntry.FileType != FSEntry.FSEntryType.Directory &&
				fsEntry.FileType != FSEntry.FSEntryType.File)
				e.CancelEdit = true;

			base.OnBeforeLabelEdit (e);
		}
Пример #51
0
 private void lvRecords_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     if (e.Label != null)
     {
         DataRow record_row = (DataRow)this.lvRecords.Items[e.Item].Tag;
         record_row["Phrase"] = e.Label;
     }
 }
Пример #52
0
 protected void OnBeforeLabelEdit(LabelEditEventArgs e)
 {
 }
Пример #53
0
 protected void OnAfterLabelEdit(LabelEditEventArgs e)
 {
 }
Пример #54
0
		protected override void OnBeforeLabelEdit(LabelEditEventArgs e)
		{
			base.OnBeforeLabelEdit(e);
			if (!e.CancelEdit) {
				editListViewItemIndex = e.Item;
			}
		}
Пример #55
0
 void listView1_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     SetModified();
 }
Пример #56
0
 OnAfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
 }
Пример #57
0
 void annotationsBox_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
     (this.annotationList.Items[e.Item].Tag as TextAnnotation).Text = e.Label;
     this.RefreshGui(null, null);
 }
Пример #58
0
		protected override void OnAfterLabelEdit (LabelEditEventArgs e)
		{
			base.OnAfterLabelEdit (e);

			// no changes were made
			if (e.Label == null || Items [e.Item].Text == e.Label)
				return;

			FileViewListViewItem listViewItem = SelectedItems [0] as FileViewListViewItem;
			FSEntry fsEntry = listViewItem.FSEntry;

			string folder = (currentFolderFSEntry.RealName != null) ?
				currentFolderFSEntry.RealName : currentFolder;

			switch (fsEntry.FileType) {
			case FSEntry.FSEntryType.Directory:
				string sourceDir = (fsEntry.RealName != null) ? fsEntry.RealName : fsEntry.FullName;
				string destDir = Path.Combine (folder, e.Label);
				if (!vfs.MoveFolder (sourceDir, destDir)) {
					e.CancelEdit = true;
				} else {
					if (fsEntry.RealName != null)
						fsEntry.RealName = destDir;
					else
						fsEntry.FullName = destDir;
				}
				break;
			case FSEntry.FSEntryType.File:
				string sourceFile = (fsEntry.RealName != null) ? fsEntry.RealName : fsEntry.FullName;
				string destFile = Path.Combine (folder, e.Label);
				if (!vfs.MoveFile (sourceFile, destFile)) {
					e.CancelEdit = true;
				} else {
					if (fsEntry.RealName != null)
						fsEntry.RealName = destFile;
					else
						fsEntry.FullName = destFile;
				}
				break;
			}
		}
Пример #59
0
 private void lstKeys_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     //Change the key
     if (_lastTranslation != null && lstKeys.SelectedItems.Count > 0)
     {
         _collection.StringsTable.Remove(_lastTranslation.Key);
         _lastTranslation.Key = e.Label;
         lstKeys.SelectedItems[0].Name = e.Label;
         lstKeys.SelectedItems[0].Text = e.Label;
         _lastTranslation.BumpVersion = true;
         _collection.StringsTable.Add(e.Label, _lastTranslation);
         lstKeys.LabelEdit = false;
     }
 }
 private void lstItems_AfterLabelEdit(object sender, System.Windows.Forms.LabelEditEventArgs e)
 {
 }