Ejemplo n.º 1
0
        private void DoRegStuff(object obj)
        {
            try
            {
                DataUtility dataUtility = new DataUtility();
                dataUtility.RegisterParserDLL();
                List<RegData> regDataCollection = null;

                Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                {
                    if ((regDataCollection = dataUtility.SelectRegistryData()) != null)
                    {
                        regCollection = regDataCollection;
                        lstRegData.ItemsSource = regCollection;
                    }
                    lblStatusText.Content = "Ready";
                    lblStatusText.Foreground = Brushes.Black;
                    btnCpuStatus.IsEnabled = true;

                    if (regCollection != null && regCollection.Count > 0)
                    {
                        btnParkAll.IsEnabled = true;
                        btnUnparkAll.IsEnabled = true;
                    }
                }));
            }
            catch (Exception)
            {
                lblStatusText.Content = "Unexpected error";
                lblStatusText.Foreground = Brushes.Red;
                btnCpuStatus.IsEnabled = true;
            }
        }
Ejemplo n.º 2
0
 private void btnUnparkAll_Click(object sender, RoutedEventArgs e)
 {
     if (regCollection != null && regCollection.Count > 0)
     {
         foreach (RegData data in regCollection)
         {
             DataUtility utility = new DataUtility();
             utility.Write(data.Path, data.ValueName, 0);
         }
         GetRegistryData();
         lblStatusText.Content = "Reboot for changes to take effect!";
         lblStatusText.Foreground = Brushes.Green;
     }
 }