//private void OpenFromDB(object data) //{ // polSet.LogUpdateMessage += new PolicySet.LogUpdate(Open_LogUpdateMessage); // polSet.OpenDBBackupSet(Int32.Parse(data.ToString())); // this.Dispatcher.Invoke(OpenFinishedMethodInstance, null); //} //private void CompareDBButton_Click(object sender, RoutedEventArgs e) //{ // if (polSet != null) // { // BackupSetSelector setSelect = new BackupSetSelector(); // setSelect.Owner = this; // setSelect.ShowDialog(); // if (setSelect.ReturnValue == BackupSetSelector.RETURN_OK) // { // if (polSet == null) // polSet = new PolicySet(); // thread = new Thread(this.RunDBCompareFunction); // thread.Start(setSelect.SelectedBackupSetID); // StartProgressDialog(); // } // } //} private void Menu_Search_PolicyItems_Click(object sender, RoutedEventArgs e) { List <SearchablePolicyItem> SpItems = new List <SearchablePolicyItem>(); foreach (Policy pol in polSet.Policies) { foreach (PolicyFile pf in pol.PolicyFiles) { foreach (PolicyItem pi in pf.PolicyItems) { SearchablePolicyItem Spi = new SearchablePolicyItem(); Spi.ParentPolicy = pol; Spi.Context = pf.Type == PolicyFile.POLICY_FILE_TYPE_MACHINE ? "Machine" : "Users"; Spi.Linkage = -1; Spi.Value = pi.Value; Spi.Key = pi.Key; Spi.Data = pi.Data; Spi.Type = pi.StringType; SpItems.Add(Spi); } } } //PolSearcher.PolicyItems.ItemsSource = SpItems; PolicySearcher PolSearcher = new PolicySearcher(SpItems); PolSearcher.Owner = this; PolSearcher.ShowDialog(); }
void CopyCmdExecuted(object target, ExecutedRoutedEventArgs e) { ListView lv = e.OriginalSource as ListView; string copyContent = String.Empty; int count = 0; foreach (object item in lv.SelectedItems) { if (count > 0) { copyContent += Environment.NewLine; } if (item is SearchablePolicyItem) { SearchablePolicyItem policyItem = (SearchablePolicyItem)item; copyContent += policyItem.ParentPolicy.Name + "\t" + policyItem.Key + "\t" + policyItem.Value + "\t" + policyItem.Type + "\t" + policyItem.Data; } count++; } try { Clipboard.SetData(DataFormats.Text, copyContent); } catch { } }
public bool FilterListView(Object item) { SearchablePolicyItem Spi = (SearchablePolicyItem)item; // return (OUFilter.Text.Trim().Length == 0 || Spi.ParentPolicy.IsLinked(OUFilter.Text)) && ((FilterText.Text.Length < 1 || (Spi.Key.ToUpper().Contains(FilterText.Text.ToUpper()) || return((FilterText.Text.Length < 1 || (Spi.Key.ToUpper().Contains(FilterText.Text.ToUpper()) || Spi.ParentPolicy.Name.ToUpper().Contains(FilterText.Text.ToUpper()) || Spi.Value.ToUpper().Contains(FilterText.Text.ToUpper()) || Spi.Data.ToUpper().Contains(FilterText.Text.ToUpper()))) && ((IncludeMachine.IsChecked.Value && Spi.Context.Equals("Machine")) || (IncludeUser.IsChecked.Value && Spi.Context.Equals("Users"))) && (IncludeUnlink.IsChecked.Value || (!IncludeUnlink.IsChecked.Value && Spi.ParentPolicy.LinkedTo.Count > 0))); }