コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SaveProtocolRecordParams"/> class.
 /// </summary>
 /// <param name="baseParams">The base params.</param>
 /// <param name="protocolRecord">The protocol record.</param>
 public SaveProtocolRecordParams(SaveProtocolSessionParams baseParams, ProtocolRecord protocolRecord)
     : base(baseParams, baseParams.ProtocolSession)
 {
     ProtocolRecord = protocolRecord;
 }
コード例 #2
0
 /// <summary>
 /// Creates the packages for prepared data.
 /// </summary>
 /// <param name="rootContext">The root context.</param>
 private void createPackages(SaveProtocolParams rootContext)
 {
     if (rootContext.Worker.CancellationPending) return;
     removeEmptySessions();
     var i = 0;
     foreach (var sessionList in BuildSessionInfo.PacketTargets.Values)
     {
         rootContext.Worker.ReportPercent((double)i++ / (double)BuildSessionInfo.PacketTargets.Values.Count());
         if (rootContext.Worker.CancellationPending) break;
         foreach (var saveSessionInfo in sessionList)
         {
             if (rootContext.Worker.CancellationPending) break;
             var sessionParams = new SaveProtocolSessionParams(rootContext, saveSessionInfo.ProtocolSession);
             foreach (var protocolRecord in saveSessionInfo.ProtocolRecords)
             {
                 if (rootContext.Worker.CancellationPending) break;
                 var recordParams = new SaveProtocolRecordParams(sessionParams, protocolRecord);
                 createPackageRecord(recordParams, saveSessionInfo.TargetNode);
             }
         }
     }
     BuildSessionInfo.PacketTargets.Clear();
 }
コード例 #3
0
        /// <summary>
        /// Specify target nodes for protocol session.
        /// </summary>
        /// <param name="context">The context.</param>
        private void routeProtocolSession(SaveProtocolSessionParams context)
        {
            context.Worker.ReportProgress(string.Format(Localizer.SavingSessionData,
                                                          context.ProtocolSession.Oid));

            var protocolRecords = context.ProtocolSession.ProtocolRecords.OrderBy(x => x.ModifiedOn);

            // route each protocol record
            // (don't interrupt saving on cancel because session data should stay consistent in package)
            foreach (var record in protocolRecords)
                routeProtocolRecord(new SaveProtocolRecordParams(context, record));

            // mark current protocol session as saved
            context.ProtocolSession.SessionIsSaved = true;

            context.Worker.ReportProgress(string.Format(Localizer.SessionDataSaved,
                                                           context.ProtocolSession.Oid));
        }