示例#1
0
        private void Next_Click(object sender, RoutedEventArgs e)
        {
            isoStore.CreateDirectory("PCGuardian/guest/blocked");
            isoStore.CreateDirectory("PCGuardian/guest/blocked/1party");
            isoStore.CreateDirectory("PCGuardian/guest/blocked/2party");
            foreach (String apps in _1stparty.SelectedItems)
            {
                String appPath = String.Empty;
                try
                {
                    appPath = MyFunctions.GetApplictionInstallPath(apps);
                    //MessageBox.Show(appPath);
                    List <String> ls = new List <String>();
                    MyFunctions.GetFileExeNameByFileDescription(appPath, ref ls, 1);
                    String[] allexecutables = ls.ToArray();
                    String   file           = "PCGuardian/guest/blocked/1party/" + apps + ".txt";
                    using (IsolatedStorageFileStream isoStream1 = new IsolatedStorageFileStream(file, FileMode.CreateNew, isoStore))
                    {
                        using (StreamWriter writer = new StreamWriter(isoStream1))
                        {
                            foreach (String exef in allexecutables)
                            {
                                writer.WriteLine(exef);
                            }
                        }
                    }
                }
                catch (Exception popup)
                {
                    //MessageBox.Show(appPath);
                }
            }

            foreach (String apps in _2ndparty.SelectedItems)
            {
                String appPath = MyFunctions.GetApplictionInstallPath(apps);
                //MessageBox.Show(appPath);
                try
                {
                    List <String> ls = new List <String>();
                    MyFunctions.GetFileExeNameByFileDescription(appPath, ref ls, 1);
                    String[] allexecutables = ls.ToArray();
                    String   file2          = "PCGuardian/guest/blocked/2party/" + apps + ".txt";
                    using (IsolatedStorageFileStream isoStream2 = new IsolatedStorageFileStream(file2, FileMode.CreateNew, isoStore))
                    {
                        using (StreamWriter writer2 = new StreamWriter(isoStream2))
                        {
                            foreach (String exef2 in allexecutables)
                            {
                                writer2.WriteLine(exef2);
                            }
                            writer2.Close();
                        }
                        isoStream2.Close();
                    }
                }
                catch (Exception popup)
                {
                    //MessageBox.Show(popup.ToString());
                    //MessageBox.Show(appPath);
                }
            }

            this.NavigationService.Navigate(new createUserSetup());
        }