示例#1
0
        /// <summary>
        /// Update the User based on an EntityRow.
        /// </summary>
        /// <param name="entityRow">The row to update from.</param>
        public override void Update(EntityRow entityRow)
        {
            UserRow userRow = DataModel.User.UserKey.Find(entityRow.EntityId);

            base.Update(entityRow);

            if (userRow != null)
            {
                if (!this.Modified && entityRow.EntityId == this.EntityId)
                {
                    this.IdentityName = userRow.IdentityName;
                    this.isRemoved    = userRow.IsRemoved;

                    this.groups.Clear();
                    foreach (GroupUsersRow groupRow in userRow.GetGroupUsersRows())
                    {
                        this.groups.Add(Entity.New(groupRow.GroupRow.RightsHolderRow.EntityRow) as Group);
                    }

                    // The information kept in AD takes a really long time to come back, so we'll grab it in another thread.
                    ThreadPoolHelper.QueueUserWorkItem(data => this.LoadAdInformation(data as String), this.IdentityName);
                }

                this.rowVersion = userRow.RowVersion;
            }
        }
示例#2
0
 /// <summary>
 /// Handle the apply command.
 /// </summary>
 /// <param name="sender">The apply button.</param>
 /// <param name="eventArgs">The event arguments.</param>
 private void OnApply(object sender, EventArgs eventArgs)
 {
     ThreadPoolHelper.QueueUserWorkItem(
         data =>
         this.Apply(data as Blotter),
         this.Entity.Clone());
 }
        /// <summary>
        /// Create a new user accounts window.
        /// </summary>
        public WindowUserAccounts()
        {
            InitializeComponent();
            this.Loaded   += this.OnLoaded;
            this.Unloaded += this.OnUnloaded;

            ThreadPoolHelper.QueueUserWorkItem(data => this.CheckAdminStatus());
        }
        private void reportMatch_SelectionChanged(object sender, EventArgs e)
        {
            ReportCell reportCell = ViewerDebtBlotter.reportMatch.FocusedCell;

            if (reportCell != null)
            {
                ThreadPoolHelper.QueueUserWorkItem(InitializeMatchReport, reportCell);
            }
        }
        /// <summary>
        /// Updates the data in the report.
        /// </summary>
        public override void Refresh()
        {
            if (this.reportGrid != null)
            {
                this.reportGrid.UpdateBodyCanvasCursor(true);
            }

            ThreadPoolHelper.QueueUserWorkItem(RefreshThread);
        }
 /// <summary>
 /// Handles the end of merging data into the client side data model.
 /// </summary>
 /// <param name="sender">The object that originated the event.</param>
 /// <param name="eventArgs">The unused event arguments.</param>
 private void OnEndMerge(object sender, EventArgs eventArgs)
 {
     // The content of the report is regenerated in a worker thread when the data related to this report has changed.  When
     // the content is regenerated, it will be sent to the foreground to be presented in the report.
     if (this.isDataChanged)
     {
         ThreadPoolHelper.QueueUserWorkItem(RefreshThread, false);
         this.isDataChanged = false;
     }
 }
        /// <summary>
        /// Handle the Entity changing.
        /// </summary>
        protected override void OnEntityChanged()
        {
            base.OnEntityChanged();

            ThreadPoolHelper.QueueUserWorkItem(delegate(object data)
            {
                lock (DataModel.SyncRoot)
                    this.entityId = (Guid)data;
            },
                                               this.Entity.EntityId);
        }
        private void OnOkay(object sender, EventArgs eventArgs)
        {
            String name   = this.OrganizationName;
            Guid   typeId = this.OrganizationType;

            ThreadPoolHelper.QueueUserWorkItem(
                data =>
                this.Create(name, typeId));

            this.Close();
        }
示例#9
0
            /// <summary>
            /// ctor
            /// </summary>
            /// <param name="serverAdmin"></param>
            /// <param name="clientProxy"></param>
            /// <param name="scriptFilePath">script file to load (path to file on the server)</param>
            /// <param name="asyncTicket">ticket string to pass back to caller though callback so caller can match message to the original request</param>
            /// <param name="streamConents">should the contents of the file be streamed back to the client</param>
            public LoadSciptFileMethodImpl(ServerAdmin serverAdmin, ClientProxy clientProxy, string scriptFilePath, string asyncTicket, bool streamConents)
            {
                this.streamConents  = streamConents;
                this.clientProxy    = clientProxy;
                this.serverAdmin    = serverAdmin;
                this.scriptFilePath = scriptFilePath.Trim().ToLowerInvariant();
                this.asyncTicket    = asyncTicket;

                //start the thread to do the work
                ThreadPoolHelper.QueueUserWorkItem(new System.Threading.WaitCallback(this.LoadScriptFileProc));
            }
示例#10
0
        /// <summary>
        /// Create a new debt rule list.
        /// </summary>
        public DebtRuleList(Guid blotterId)
        {
            this.blotterId = blotterId;

            DataModel.EntityTree.RowChanged += this.OnTreeChanged;

            ThreadPoolHelper.QueueUserWorkItem(delegate(object data)
            {
                this.blotterList = this.GetBlotterList();
                this.InitializeList();
            });
        }
示例#11
0
        /// <summary>
        /// Handle the parent folder changing.
        /// </summary>
        /// <param name="sender">The unlink folder window.</param>
        /// <param name="eventArgs">The event arguments.</param>
        private static void OnParentFolderChanged(DependencyObject sender, DependencyPropertyChangedEventArgs eventArgs)
        {
            WindowUnlinkFolder chooser = sender as WindowUnlinkFolder;

            if (chooser.ParentFolder != null)
            {
                ThreadPoolHelper.QueueUserWorkItem(data => chooser.InitializeFolders((Guid)data), chooser.ParentFolder.EntityId);
            }
            else
            {
                chooser.Folders = null;
            }
        }
        /// <summary>
        /// Handle the Group changing.
        /// </summary>
        /// <param name="eventArgs">The event arguments.</param>
        private void OnGroupChanged(DependencyPropertyChangedEventArgs eventArgs)
        {
            ThreadPoolHelper.QueueUserWorkItem(delegate(object guid)
            {
                lock (DataModel.SyncRoot)
                    this.groupId = (Guid)guid;
            }, this.Group.GroupId);

            this.users.ItemsSource = new UserList()
            {
                FilterMethod = u => (u as User).Groups.Any(g => g.GroupId == this.groupId)
            };
        }
        /// <summary>
        /// Refreshes the data in the report in a worker thread.
        /// </summary>
        /// <param name="state">The unused thread start parameters.</param>
        private void RefreshThread(object state)
        {
            bool requestGC = true.Equals(state);

            // Once the module is compiled and loaded into memory, an instance of the specified viewer is created.  The
            // IDocumentView is all that is needed to communicate with the loaded view.  Note that an array of delegates is passed
            // into the newly compiled and loaded View that allow the View to communicate back to the host Viewer.

            // Note that SetContent method will dispatch the thread hence it was not done here.
            lock (DataModel.SyncRoot)
                this.SetContent(this.CreditCardHeaderSelector(this.guid), requestGC);

            ThreadPoolHelper.QueueUserWorkItem(RefreshThreadCompleted);
        }
示例#14
0
        /// <summary>
        /// Handle the Okay event.
        /// </summary>
        /// <param name="sender">The cancel button.</param>
        /// <param name="eventArgs">The event arguments.</param>
        protected override void OnOkay(object sender, ExecutedRoutedEventArgs eventArgs)
        {
            if (this.Folder != null)
            {
                Entity parent = this.ParentFolder.Clone() as Entity;
                Entity child  = this.Folder.Clone() as Entity;
                ThreadPoolHelper.QueueUserWorkItem(data => this.Commit(parent, child));
                this.DialogResult = true;
            }
            else
            {
                this.DialogResult = false;
            }

            this.Close();
        }
        /// <summary>
        /// Change data contexts when the entity changes.
        /// </summary>
        protected override void OnEntityChanged()
        {
            Guid entityId   = this.Entity.EntityId;
            Guid?debtRuleId = (this.Entity as DebtClass).DebtRuleId;

            base.OnEntityChanged();

            ThreadPoolHelper.QueueUserWorkItem(delegate(object data)
            {
                lock (DataModel.SyncRoot)
                {
                    this.entityId   = entityId;
                    this.debtRuleId = debtRuleId;
                }
            });
        }
        /// <summary>
        /// Create a new properties dialog box.
        /// </summary>
        public WindowBlotterProperties()
            : base()
        {
            this.BuildPaymentScheduleTab();
            this.CommandBindings.Add(new CommandBinding(WindowBlotterProperties.EditCommissionSchedule, this.OnEditCommissionSchedule, this.CanEditCommissionSchedule));
            ThreadPoolHelper.QueueUserWorkItem(data =>
                                               this.InitializeUser());

            this.Loaded += delegate(object sender, RoutedEventArgs eventArgs)
            {
                DataModel.Blotter.RowChanging += this.FilterRow;
            };
            this.Unloaded += delegate(object sender, RoutedEventArgs eventArgs)
            {
                DataModel.Blotter.RowChanging -= this.FilterRow;
            };
        }
        /// <summary>
        /// Handle the Entity changing.
        /// </summary>
        protected override void OnEntityChanged()
        {
            base.OnEntityChanged();

            (this.Entity as User).Groups.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs eventArgs)
            {
                if (!this.Populating)
                {
                    this.CanApply = true;
                }
            };

            ThreadPoolHelper.QueueUserWorkItem(delegate(object data)
            {
                lock (DataModel.SyncRoot)
                    this.entityId = (Guid)data;
            },
                                               this.Entity.EntityId);
        }
示例#18
0
        /// <summary>
        /// Load up the user-specific information.
        /// </summary>
        protected override void FinishLoad()
        {
            UserRow userRow = DataModel.User.UserKey.Find(this.EntityId);

            base.FinishLoad();

            this.isRemoved    = userRow.IsRemoved;
            this.identityName = userRow.IdentityName;
            this.rowVersion   = userRow.RowVersion;

            if (this.groups == null)
            {
                this.groups = new ObservableCollection <Group>();
                this.groups.CollectionChanged += this.OnGroupsChanged;
            }

            foreach (GroupUsersRow groupRow in userRow.GetGroupUsersRows())
            {
                this.groups.Add(Entity.New(groupRow.GroupRow.RightsHolderRow.EntityRow) as Group);
            }

            // The information kept in AD takes a really long time to come back, so we'll grab it in another thread.
            ThreadPoolHelper.QueueUserWorkItem(data => this.LoadAdInformation(data as String), this.IdentityName);
        }
示例#19
0
 /// <summary>
 /// Create a new link folder window.
 /// </summary>
 public WindowLinkFolder() : base()
 {
     ThreadPoolHelper.QueueUserWorkItem(data => this.InitializeFolders());
 }
 /// <summary>
 /// Create a new RightsHolderListBox.
 /// </summary>
 public RightsHolderListBox()
 {
     ThreadPoolHelper.QueueUserWorkItem(data => this.DetermineMultiTenant());
 }
 /// <summary>
 /// Initializes the components found in the dynamic XAML source.
 /// </summary>
 public void LoadSource()
 {
     ThreadPoolHelper.QueueUserWorkItem(LoadSource);
 }
 private void OnLoad(object sender, EventArgs eventArgs)
 {
     ThreadPoolHelper.QueueUserWorkItem(this.LoadTypes);
 }
示例#23
0
 /// <summary>
 /// Build new settlement template control.
 /// </summary>
 public EditSettlementTemplateControl()
 {
     InitializeComponent();
     ThreadPoolHelper.QueueUserWorkItem(data =>
                                        this.InitializeUser());
 }
示例#24
0
 /// <summary>
 /// Create a new link folder window.
 /// </summary>
 public WindowMove()
     : base()
 {
     this.Title = Properties.Resources.MoveTitle;
     ThreadPoolHelper.QueueUserWorkItem(data => this.InitializeFolders());
 }
示例#25
0
 /// <summary>
 /// Updates the data in the report.
 /// </summary>
 public override void Refresh()
 {
     ThreadPoolHelper.QueueUserWorkItem(RefreshThread, true);
 }
示例#26
0
文件: Form1.cs 项目: yyan/winform
 private void btnThreadPool_Click(object sender, EventArgs e)
 {
     ThreadPoolHelper.QueueUserWorkItem(new ThreadPoolHelper.WaitCallbackNew(UpdateText));
     ThreadPoolHelper.WaitAny();
 }