コード例 #1
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (internalchg)
            {
                return;
            }

            if (selectedResource != null)
            {
                ResourceChangingEventArgs rcea = new ResourceChangingEventArgs(selectedResource);
                OnSelectedResourceChanging(this, rcea);
                if (rcea.Cancel)
                {
                    internalchg = true;
                    listView1.SelectedItems.Clear();
                    listView1.SelectedIndices.Add(listView1.Items.IndexOf(selectedResource));
                    listView1.SelectedItems[0].EnsureVisible();
                    internalchg = false;
                    return;
                }
            }

            selectedResource = (listView1.SelectedItems.Count == 1) ? listView1.SelectedItems[0] : null;

            OnSelectedResourceChanged(this, new ResourceChangedEventArgs(selectedResource));
        }
コード例 #2
0
 protected virtual void OnSelectedResourceChanging(object sender, ResourceChangingEventArgs e)
 {
     if (SelectedResourceChanging != null)
     {
         SelectedResourceChanging(sender, e);
     }
 }
コード例 #3
0
ファイル: BrowserWidget.cs プロジェクト: falerin/Sims4Tools
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (internalchg) return;

            if (selectedResource != null)
            {
                ResourceChangingEventArgs rcea = new ResourceChangingEventArgs(selectedResource);
                OnSelectedResourceChanging(this, rcea);
                if (rcea.Cancel)
                {
                    internalchg = true;
                    listView1.SelectedItems.Clear();
                    listView1.SelectedIndices.Add(listView1.Items.IndexOf(selectedResource));
                    listView1.SelectedItems[0].EnsureVisible();
                    internalchg = false;
                    return;
                }
            }

            selectedResource = (listView1.SelectedItems.Count == 1) ? listView1.SelectedItems[0] : null;

            OnSelectedResourceChanged(this, new ResourceChangedEventArgs(selectedResource));
        }
コード例 #4
0
ファイル: BrowserWidget.cs プロジェクト: falerin/Sims4Tools
 protected virtual void OnSelectedResourceChanging(object sender, ResourceChangingEventArgs e) { if (SelectedResourceChanging != null) SelectedResourceChanging(sender, e); }