Exemplo n.º 1
0
        public PolicyView(Policy policy)
        {
            InitializeComponent();

            CommandBinding cb = new CommandBinding(ApplicationCommands.Copy, CopyCmdExecuted, CopyCmdCanExecute);

            MachinePolicyItems.CommandBindings.Add(cb);
            UserPolicyItems.CommandBindings.Add(cb);
            LinkedView.CommandBindings.Add(cb);
            AssignedView.CommandBindings.Add(cb);
            WMIView.CommandBindings.Add(cb);
            PrefPropertyList.CommandBindings.Add(cb);

            QueryFinishedMethodInstance  = new QueryFinishedDelegate(QueryFinished);
            UpdateProgViewMethodInstance = new UpdateProgViewDelegate(UpdateProgView);

            this.Title = "Policy - " + policy.Name;
            thisPolicy = policy;
        }
Exemplo n.º 2
0
        public Window1()
        {
            InitializeComponent();

            CommandBinding cb = new CommandBinding(ApplicationCommands.Copy, CopyCmdExecuted, CopyCmdCanExecute);

            PoliciesListView.CommandBindings.Add(cb);


            // Menu_File_Save_DB.IsEnabled = DB.HasDBSaveRights();

            ADMXLoadFinishedMethodInstance = new ADMXLoadFinishedDelegate(AdmxLoadFinish);
            QueryFinishedMethodInstance    = new QueryFinishedDelegate(QueryFinished);
            CompareFinishedMethodInstance  = new CompareFinishedDelegate(CompareFinished);
            SaveFinishedMethodInstance     = new SaveFinishedDelegate(SaveFinished);
            OpenFinishedMethodInstance     = new OpenFinishedDelegate(OpenFinished);
            UpdateProgViewMethodInstance   = new UpdateProgViewDelegate(UpdateProgView);

            arInfo = new AutoRunInfo(Environment.GetCommandLineArgs());

            if (arInfo.AutoRun() || arInfo.LogToDB)
            {
                polSet = new PolicySet();
                polSet.GPOM.LogUpdateMessage += new GPOManagement.LogUpdate(GPOM_LogUpdateMessage);
                polSet.GetAllPolicies();

                if (arInfo.LogToAutoPath())
                {
                    Stream          stream     = File.Open(arInfo.GetSaveFilename(), FileMode.Create);
                    BinaryFormatter bformatter = new BinaryFormatter();
                    bformatter.Serialize(stream, polSet);
                    stream.Close();
                }

                if (arInfo.LogToAutoPath() && arInfo.CompareToYesterday())
                {
                    Stream          YesterdaysStream    = File.Open(arInfo.GetYesterdaysFile(), FileMode.Open);
                    BinaryFormatter bformatter2         = new BinaryFormatter();
                    PolicySet       YesterdaysPolicySet = (PolicySet)bformatter2.Deserialize(YesterdaysStream);
                    YesterdaysStream.Close();

                    List <DiffPolicyInfo> PolInfo = polSet.Compare(YesterdaysPolicySet, false);

                    Stream          compareStream = File.Open(arInfo.GetSaveCompareFilename(), FileMode.Create);
                    BinaryFormatter bformatter3   = new BinaryFormatter();
                    bformatter3.Serialize(compareStream, PolInfo);
                    compareStream.Close();
                }

                //if (arInfo.LogToDB)
                //{
                //    polSet.CreateDBBackupSet();

                //    int GetPreviousBackupID = DB.GetPreviousBackupID(polSet.BackupSetID);

                //    if (GetPreviousBackupID > 0)
                //    {

                //        List<DiffPolicyInfo> PolInfo = null;
                //        PolicySet LastDBBackup = new PolicySet();

                //        LastDBBackup.OpenDBBackupSet(GetPreviousBackupID);
                //        PolInfo = polSet.Compare(LastDBBackup,arInfo.CheckPreviousRelease);

                //        foreach (DiffPolicyInfo polDiff in PolInfo)
                //        {
                //            polDiff.LogDeletions(GetPreviousBackupID);
                //        }

                //    }

                //}
            }
        }