internal override void OnReadData(CommandInteractionHandler interactionHandler, string pageName)
        {
            ICloneable cloneable = (ICloneable)this.parentContext.ReadData(interactionHandler, pageName);
            int        count     = this.parentContext.DataHandler.DataHandlers.Count;

            if (count != 0)
            {
                this.dataSources = new object[count];
                for (int i = 0; i < count; i++)
                {
                    DataHandler dataHandler = this.parentContext.DataHandler.DataHandlers[i];
                    if (dataHandler.ReadOnly)
                    {
                        this.dataSources[i] = dataHandler.DataSource;
                    }
                    else if (dataHandler.DataSource is ICloneable)
                    {
                        this.dataSources[i] = ((ICloneable)dataHandler.DataSource).Clone();
                    }
                    else
                    {
                        this.dataSources[i] = null;
                    }
                }
                base.DataSource = this.DataSources[0];
                return;
            }
            this.dataSources = new object[0];
            base.DataSource  = (this.parentContext.DataHandler.ReadOnly ? cloneable : cloneable.Clone());
        }
 internal virtual void OnSaveData(CommandInteractionHandler interactionHandler)
 {
     if (this.HasDataHandlers)
     {
         this.SavedResults.Clear();
         foreach (DataHandler dataHandler in this.DataHandlers)
         {
             if (dataHandler.IsModified())
             {
                 if (this.Cancelled)
                 {
                     break;
                 }
                 dataHandler.ProgressReport += this.OnProgressReport;
                 try
                 {
                     dataHandler.Save(interactionHandler);
                 }
                 finally
                 {
                     dataHandler.ProgressReport -= this.OnProgressReport;
                 }
                 this.SavedResults.AddRange(dataHandler.SavedResults);
                 if (this.BreakOnError && !dataHandler.IsSucceeded)
                 {
                     break;
                 }
             }
         }
     }
 }
 internal void Save(CommandInteractionHandler interactionHandler)
 {
     if (!this.ReadOnly)
     {
         if (this.HasWorkUnits)
         {
             foreach (WorkUnit workUnit in this.WorkUnits)
             {
                 workUnit.ResetStatus();
             }
         }
         if (!this.HasWorkUnits)
         {
             this.UpdateWorkUnits();
         }
         if (!this.Cancelled)
         {
             CancelEventArgs cancelEventArgs = new CancelEventArgs();
             this.OnSavingData(cancelEventArgs);
             if (!cancelEventArgs.Cancel)
             {
                 this.OnSaveData(interactionHandler);
                 if (!this.HasWorkUnits || !this.WorkUnits.HasFailures)
                 {
                     this.ClearParameterNames();
                 }
             }
         }
     }
 }
Exemple #4
0
        internal object ReadData(CommandInteractionHandler interactionHandler, string pageName)
        {
            if (!this.needToReadData)
            {
                if (!(this.DataHandler is AutomatedDataHandler))
                {
                    goto IL_53;
                }
            }
            try
            {
                this.isAccessingData = true;
                this.DataHandler.Read(interactionHandler, pageName);
                this.needToReadData = false;
                if (!this.bypassCorruptObjectVerification)
                {
                    this.IsDataSourceCorrupted = this.dataHandler.IsCorrupted;
                }
            }
            finally
            {
                this.isAccessingData = false;
            }
IL_53:
            return(this.DataHandler.DataSource);
        }
        internal override void OnReadData(CommandInteractionHandler interactionHandler, string pageName)
        {
            DataTable dataTable = this.DataTable.Clone();

            this.OnFillTable(dataTable, interactionHandler);
            this.synchronizationContext.Send(new SendOrPostCallback(this.CopyChangeFromTableForRead), dataTable);
        }
Exemple #6
0
 internal void SaveData(CommandInteractionHandler interactionHandler)
 {
     if (this.IsDirty)
     {
         try
         {
             this.isAccessingData = true;
             this.DataHandler.Save(interactionHandler);
             bool flag = this.DataHandler.HasWorkUnits && this.DataHandler.WorkUnits.HasFailures;
             if (!flag)
             {
                 this.IsDirty        = false;
                 this.needToReadData = true;
             }
             if (!flag || this.DataHandler.WorkUnits.IsDataChanged)
             {
                 this.OnDataSaved(EventArgs.Empty);
             }
         }
         finally
         {
             this.isAccessingData = false;
         }
     }
 }
Exemple #7
0
 internal override void OnSaveData(CommandInteractionHandler interactionHandler)
 {
     if (this.mockSettings.ObjectState == ObjectState.Changed)
     {
         PSConnectionInfoSingleton.GetInstance().UpdateRemotePSServer(this.mockSettings.AutomaticallySelect ? null : this.mockSettings.RemotePSServer);
     }
     base.OnSaveData(interactionHandler);
 }
        internal override void OnSaveData(CommandInteractionHandler interactionHandler)
        {
            AutomatedDataHandlerBase automatedDataHandlerBase = this.parentContext.DataHandler as AutomatedDataHandlerBase;

            automatedDataHandlerBase.DataObjectStore = base.DataObjectStore;
            automatedDataHandlerBase.RefreshDataObjectStoreWithNewTable();
            this.parentContext.IsDirty = true;
        }
        internal override void OnReadData(CommandInteractionHandler interactionHandler, string pageName)
        {
            DataTable table = (DataTable)this.parentContext.DataHandler.DataSource;

            base.Table.Merge(table);
            base.DataObjectStore = ((AutomatedDataHandlerBase)this.parentContext.DataHandler).DataObjectStore.Clone();
            base.RefreshDataObjectStore();
            base.DataSource = base.Table;
        }
Exemple #10
0
 internal override void OnReadData(CommandInteractionHandler interactionHandler, string pageName)
 {
     PSConnectionInfoSingleton.GetInstance().GetMonadConnectionInfo();
     this.mockSettings                     = new PSRemoteServer();
     this.mockSettings.DisplayName         = this.displayName;
     this.mockSettings.UserAccount         = PSConnectionInfoSingleton.GetInstance().UserAccount;
     this.mockSettings.RemotePSServer      = PSConnectionInfoSingleton.GetInstance().RemotePSServer;
     this.mockSettings.AutomaticallySelect = (this.mockSettings.RemotePSServer == null);
     base.DataSource = this.mockSettings;
     base.OnReadData(interactionHandler, pageName);
 }
Exemple #11
0
 internal override void OnReadData(CommandInteractionHandler interactionHandler, string pageName)
 {
     try
     {
         base.OnReadData(interactionHandler, pageName);
     }
     finally
     {
         base.DataSource = this;
     }
 }
Exemple #12
0
 internal override void Run(CommandInteractionHandler interactionHandler, DataRow row, DataObjectStore store)
 {
     this.Saver.Run(interactionHandler, row, store);
     if (this.Saver.SavedResults.Count > 0)
     {
         foreach (string text in this.SavedResultMapping.Keys)
         {
             object value = (text != "WholeObjectProperty") ? this.Saver.SavedResults[0].GetType().GetProperty(text).GetValue(this.Saver.SavedResults[0], null) : this.Saver.SavedResults[0];
             row[this.SavedResultMapping[text]] = value;
         }
     }
 }
Exemple #13
0
 public override void Open(IUIService service, WorkUnitCollection workUnits, bool enforceViewEntireForest, ResultsLoaderProfile profile)
 {
     this.isResultPane = !enforceViewEntireForest;
     this.workUnits = workUnits;
     this.commandInteractionHandler = ((service != null) ? new WinFormsCommandInteractionHandler(service) : new CommandInteractionHandler());
     RunspaceServerSettingsPresentationObject runspaceServerSettingsPresentationObject = ADServerSettingsSingleton.GetInstance().CreateRunspaceServerSettingsObject();
     if (enforceViewEntireForest && runspaceServerSettingsPresentationObject != null)
     {
         runspaceServerSettingsPresentationObject.ViewEntireForest = true;
     }
     this.connection = new MonadConnection(PSConnectionInfoSingleton.GetInstance().GetConnectionStringForScript(), this.commandInteractionHandler, runspaceServerSettingsPresentationObject, PSConnectionInfoSingleton.GetInstance().GetMonadConnectionInfo(profile.SerializationLevel));
     this.connection.Open();
 }
Exemple #14
0
 internal void Read(CommandInteractionHandler interactionHandler, string pageName)
 {
     if (!this.Cancelled)
     {
         CancelEventArgs cancelEventArgs = new CancelEventArgs();
         this.OnReadingData(cancelEventArgs);
         if (!cancelEventArgs.Cancel)
         {
             this.OnReadData(interactionHandler, pageName);
             this.CheckObjectReadOnly();
         }
     }
 }
        internal override void OnSaveData(CommandInteractionHandler interactionHandler)
        {
            this.dataAdapter.SelectCommand.Connection.InteractionHandler = interactionHandler;
            DataTable state = this.CreateUpdateTable();

            try
            {
                this.dataAdapter.Update(state);
            }
            finally
            {
                this.synchronizationContext.Send(new SendOrPostCallback(this.CopyChangeFromTableForUpdate), state);
            }
        }
Exemple #16
0
 internal virtual void OnReadData(CommandInteractionHandler interactionHandler, string pageName)
 {
     if (this.HasDataHandlers)
     {
         foreach (DataHandler dataHandler in this.DataHandlers)
         {
             if (this.Cancelled)
             {
                 break;
             }
             dataHandler.Read(interactionHandler, pageName);
         }
         this.DataSource = this.DataHandlers[0].DataSource;
     }
 }
Exemple #17
0
 internal sealed override void OnSaveData(CommandInteractionHandler interactionHandler)
 {
     this.Connection.InteractionHandler = interactionHandler;
     using (new OpenConnection(this.Connection))
     {
         MonadParameter[] array = new MonadParameter[this.Parameters.Count];
         this.Parameters.CopyTo(array, 0);
         MonadParameter[] values = this.PrepareParameters();
         this.Parameters.Clear();
         this.Parameters.AddRange(values);
         this.OnSaveData();
         base.OnSaveData(interactionHandler);
         this.Parameters.Clear();
         this.Parameters.AddRange(array);
     }
 }
Exemple #18
0
 internal sealed override void OnReadData(CommandInteractionHandler interactionHandler, string pageName)
 {
     this.Connection.InteractionHandler = interactionHandler;
     using (new OpenConnection(this.Connection))
     {
         this.OnReadData();
         object dataSource = base.DataSource;
         try
         {
             base.OnReadData(interactionHandler, pageName);
         }
         finally
         {
             base.DataSource = dataSource;
         }
     }
 }
 internal override void OnSaveData(CommandInteractionHandler interactionHandler)
 {
     base.SavedResults.Clear();
     using (CommandExecutionContext commandExecutionContext = this.saverExecutionContextFactory.CreateExecutionContext())
     {
         WinFormsCommandInteractionHandler winFormsCommandInteractionHandler = interactionHandler as WinFormsCommandInteractionHandler;
         IUIService service = (winFormsCommandInteractionHandler == null) ? null : winFormsCommandInteractionHandler.UIService;
         commandExecutionContext.Open(service);
         foreach (SaverTaskProfile saverTaskProfile in this.saverTaskProfileList)
         {
             if (base.Cancelled)
             {
                 break;
             }
             if (saverTaskProfile.IsRunnable(base.Row, base.DataObjectStore))
             {
                 saverTaskProfile.BuildParameters(base.Row, base.DataObjectStore);
                 try
                 {
                     saverTaskProfile.Runner.ProgressReport += base.OnProgressReport;
                     commandExecutionContext.Execute(saverTaskProfile, base.Row, base.DataObjectStore);
                 }
                 finally
                 {
                     saverTaskProfile.Runner.ProgressReport -= base.OnProgressReport;
                 }
                 base.SavedResults.AddRange(saverTaskProfile.SavedResults);
                 if (base.BreakOnError && !saverTaskProfile.IgnoreException && !saverTaskProfile.IsSucceeded)
                 {
                     break;
                 }
             }
         }
         if (!base.HasWorkUnits || !base.WorkUnits.HasFailures)
         {
             if (commandExecutionContext.ShouldReload)
             {
                 this.pageToReaderTaskMapping.Reset();
             }
             base.DataObjectStore.ClearModifiedColumns();
         }
     }
 }
Exemple #20
0
        internal override void OnSaveData(CommandInteractionHandler interactionHandler)
        {
            Timer timer  = null;
            Timer timer2 = null;

            try
            {
                if (this.StartTaskAtScheduledTime && this.StartTime > (DateTime)ExDateTime.Now)
                {
                    this.startEvent.Reset();
                    timer = new Timer(new TimerCallback(this.OnStart), null, 0, 1000);
                }
                if (WaitHandle.WaitAny(new WaitHandle[]
                {
                    this.startEvent,
                    this.cancelEvent
                }) == 0 && !base.Cancelled)
                {
                    if (this.CancelTaskAtScheduledTime)
                    {
                        this.cancelEvent.Reset();
                        timer2 = new Timer(new TimerCallback(this.OnCancel), null, (long)((ulong)this.IntervalHours.Value * 3600UL * 1000UL), -1L);
                    }
                    base.OnSaveData(interactionHandler);
                }
            }
            finally
            {
                if (timer != null)
                {
                    timer.Dispose();
                }
                if (timer2 != null)
                {
                    timer2.Dispose();
                }
            }
        }
 internal override void OnSaveData(CommandInteractionHandler interactionHandler)
 {
     if (this.parentContext.DataHandler.DataHandlers.Count != 0)
     {
         for (int i = 0; i < this.DataSources.Length; i++)
         {
             DataHandler dataHandler = this.parentContext.DataHandler.DataHandlers[i];
             if (this.DataSources[i] != null && !dataHandler.ReadOnly)
             {
                 if (i == 0)
                 {
                     this.parentContext.DataHandler.DataSource = this.DataSources[i];
                 }
                 dataHandler.DataSource = this.DataSources[i];
             }
         }
     }
     else
     {
         this.parentContext.DataHandler.DataSource = base.DataSource;
     }
     this.parentContext.IsDirty = true;
 }
 internal override void OnReadData(CommandInteractionHandler interactionHandler, string pageName)
 {
     if (this.pageToReaderTaskMapping.IsExecuted(pageName))
     {
         return;
     }
     if (base.Table.Rows.Count == 0)
     {
         base.Table.Rows.Add(base.Table.NewRow());
     }
     else
     {
         base.Table = base.Table.Copy();
     }
     using (CommandExecutionContext commandExecutionContext = this.CreateExecutionContextForReader())
     {
         WinFormsCommandInteractionHandler winFormsCommandInteractionHandler = interactionHandler as WinFormsCommandInteractionHandler;
         IUIService service = (winFormsCommandInteractionHandler == null) ? null : winFormsCommandInteractionHandler.UIService;
         commandExecutionContext.Open(service);
         foreach (ReaderTaskProfile readerTaskProfile in this.readerTaskProfileList)
         {
             if (readerTaskProfile.IsRunnable(base.Row, base.DataObjectStore) && this.pageToReaderTaskMapping.CanTaskExecuted(pageName, readerTaskProfile.Name))
             {
                 readerTaskProfile.BuildParameters(base.Row, base.DataObjectStore);
                 commandExecutionContext.Execute(readerTaskProfile, base.Row, base.DataObjectStore);
                 base.DataObjectStore.UpdateDataObject(readerTaskProfile.DataObjectName, readerTaskProfile.DataObject);
                 base.UpdateTable(base.Row, readerTaskProfile.DataObjectName, true);
             }
         }
     }
     if (this.pageToReaderTaskMapping.Count == 0)
     {
         base.Row.AcceptChanges();
     }
     this.pageToReaderTaskMapping.Execute(pageName);
     base.DataSource = base.Table;
 }
 internal abstract void Run(CommandInteractionHandler interactionHandler, DataRow row, DataObjectStore store);
 protected virtual MonadConnection CreateMonadConnection(IUIService uiService, CommandInteractionHandler commandInteractionHandler)
 {
     return(new MonadConnection("timeout=30", commandInteractionHandler, ADServerSettingsSingleton.GetInstance().CreateRunspaceServerSettingsObject(), PSConnectionInfoSingleton.GetInstance().GetMonadConnectionInfo()));
 }
 internal virtual void OnFillTable(DataTable table, CommandInteractionHandler interactionHandler)
 {
     this.dataAdapter.SelectCommand.Connection.InteractionHandler = interactionHandler;
     this.dataAdapter.Fill(table);
 }
        protected override MonadConnection CreateMonadConnection(IUIService uiService, CommandInteractionHandler commandInteractionHandler)
        {
            MonadConnectionInfo monadConnectionInfo = PSConnectionInfoSingleton.GetInstance().GetMonadConnectionInfo();

            return(new MonadConnection("timeout=30", commandInteractionHandler, null, new MonadConnectionInfo(PSConnectionInfoSingleton.GetRemotePowerShellUri(new Fqdn(this.ServerName)), monadConnectionInfo.Credentials, monadConnectionInfo.ShellUri, monadConnectionInfo.FileTypesXml, monadConnectionInfo.AuthenticationMechanism, monadConnectionInfo.SerializationLevel, monadConnectionInfo.ClientApplication, string.Empty, monadConnectionInfo.MaximumConnectionRedirectionCount, monadConnectionInfo.SkipServerCertificateCheck)));
        }
 internal override void Run(CommandInteractionHandler interactionHandler, DataRow row, DataObjectStore store)
 {
     (base.Runner as Reader).Run(interactionHandler, row, store);
 }