Beispiel #1
0
 public UnifiedPolicySyncNotification(SyncWorkItem workItem, ADObjectId mailboxOwnerId) : base(workItem, mailboxOwnerId)
 {
     if (workItem.WorkItemInfo != null && workItem.WorkItemInfo.Count > 0)
     {
         this.syncChangeInfos = new MultiValuedProperty <string>();
         foreach (List <SyncChangeInfo> list in workItem.WorkItemInfo.Values)
         {
             foreach (SyncChangeInfo syncChangeInfo in list)
             {
                 this.syncChangeInfos.Add(syncChangeInfo.ToString());
             }
         }
     }
 }
Beispiel #2
0
        private void Init()
        {
            var args = Environment.GetCommandLineArgs();

            if (args.Length < 2)
            {
                MessageBox.Show("Please provide path to a wpf application");
                return;
            }
            ProcessStartInfo processStartInfo = new ProcessStartInfo(args[1], string.Empty);

            processStartInfo.ErrorDialog      = true;
            processStartInfo.WorkingDirectory = string.Empty;

            try
            {
                string directoryName = Path.GetDirectoryName(processStartInfo.FileName);
                if (Path.IsPathRooted(directoryName) && Directory.Exists(directoryName))
                {
                    processStartInfo.WorkingDirectory = directoryName;
                }
                ProcessProxy proxy = (ProcessProxy)Activator.CreateInstance(typeof(ProcessProxy),
                                                                            BindingFlags.NonPublic | BindingFlags.Instance, null,
                                                                            new object[] { processStartInfo, false, clrVersion }, null);
                SyncWorkItem syncWorkItem  = new SyncWorkItem(ProcessHelper.WorkUntilWpfLoaded, proxy, null);
                SyncWorkItem syncWorkItem3 = syncWorkItem.Next = new SyncWorkItem(WorkUntilCanAttach, proxy, null);
                if (ProcessHelper.StartProxy(proxy, syncWorkItem) && AttachToProcess(new SelectProcessArgs(proxy.RemoteProcess, clrVersion)))
                {
                }

                IsAttached = mediaControl != null;
            }
            catch (ArgumentException)
            {
                IsAttached = false;
            }
            finally
            {
                if (IsAttached)
                {
                    updateTimer.Start();
                }
                else
                {
                    updateTimer.Stop();
                }
            }
        }
Beispiel #3
0
        public static SyncNotificationResult NotifySyncChanges(string identity, string targetServerFqdn, Guid tenantId, string syncSvcUrl, bool fullSync, bool syncNow, SyncChangeInfo[] syncChangeInfos)
        {
            if (string.IsNullOrEmpty(identity))
            {
                throw new ArgumentNullException("identity");
            }
            if (tenantId == Guid.Empty)
            {
                throw new ArgumentNullException("tenantId");
            }
            if (string.IsNullOrEmpty(syncSvcUrl))
            {
                throw new ArgumentNullException("syncSvcUrl");
            }
            RpcClientWrapper.InitializeIfNeeded();
            NotificationType type = NotificationType.Sync;

            if (!RpcClientWrapper.instance.initialized)
            {
                return(new SyncNotificationResult(new SyncAgentTransientException("RPC client not initialized")));
            }
            SyncNotificationResult result;

            try
            {
                using (UnifiedPolicyNotificationRpcClient unifiedPolicyNotificationRpcClient = new UnifiedPolicyNotificationRpcClient(targetServerFqdn ?? RpcClientWrapper.instance.localServer.Fqdn))
                {
                    SyncWorkItem syncWorkItem = new SyncWorkItem(identity, syncNow, new TenantContext(tenantId, null), syncChangeInfos, syncSvcUrl, fullSync, Workload.Exchange, false);
                    byte[]       data         = unifiedPolicyNotificationRpcClient.Notify(1, (int)type, syncWorkItem.Serialize());
                    NotificationRpcOutParameters notificationRpcOutParameters = new NotificationRpcOutParameters(data);
                    result = notificationRpcOutParameters.Result;
                }
            }
            catch (RpcException ex)
            {
                result = new SyncNotificationResult(new SyncAgentTransientException(ex.Message, ex));
            }
            return(result);
        }