protected virtual void OnAfterItemProcessingFinished(RenderingTask item) { if (AfterItemProcessingFinished != null) { AfterItemProcessingFinished(this, new RenderingTaskEventArgs(item)); } }
protected virtual void OnItemIndexChanged(RenderingTask item) { if (ItemIndexChanged != null) { ItemIndexChanged(this, new RenderingTaskEventArgs(item)); } }
protected virtual void OnItemRendering(RenderingTask item) { if (ItemRendering != null) { ItemRendering(this, new RenderingTaskEventArgs(item)); } }
protected virtual void OnBeforeItemProcessingStarted(RenderingTask item) { if (BeforeItemProcessingStarted != null) { BeforeItemProcessingStarted(this, new RenderingTaskEventArgs(item)); } }
public void Add(Stage stage, string source, int prescale, string destination, string fileType) { lock (mQueue) { stage.ProgressMessageReport += HandleStageProgressMessageReport; RenderingTask rt = new RenderingTask(stage, source, prescale, destination, fileType); mQueue.Add(rt); OnItemAdded(rt); } }
public void Remove(RenderingTask item) { lock (item) { if (mQueue.Contains(item)) { item.Stage.ProgressMessageReport -= HandleStageProgressMessageReport; mQueue.Remove(item); OnItemRemoved(item); } } }
void HandleStageProgressMessageReport(object sender, ReportStageProgressMessageEventArgs e) { RenderingTask rt = mInProgress; if (mCancelItem == true) { throw new UserCancelException(); } if (mCancelAllItems == true) { throw new UserCancelException(); } OnQueueProgressMessageReport(rt.Source, rt.Destination, e.Progress, e.Status, rt.Stage.CurrentImage); }
public bool StepUp(RenderingTask item) { lock (item) { int inx = mQueue.IndexOf(item); if (inx > 0 && inx < mQueue.Count) { RenderingTask prev = mQueue[inx - 1]; mQueue[inx - 1] = item; mQueue[inx] = prev; OnItemIndexChanged(item); OnItemIndexChanged(prev); return(true); } else { return(false); } } }
public bool StepDown(RenderingTask item) { lock (item) { int inx = mQueue.IndexOf(item); if (inx >= 0 && inx < mQueue.Count - 1) { RenderingTask next = mQueue[inx + 1]; mQueue[inx + 1] = item; mQueue[inx] = next; OnItemIndexChanged(item); OnItemIndexChanged(next); return(true); } else { return(false); } } }
public bool StepUp(RenderingTask item) { lock (item) { int inx = mQueue.IndexOf(item); if (inx > 0 && inx < mQueue.Count) { RenderingTask prev = mQueue[inx - 1]; mQueue[inx - 1] = item; mQueue[inx] = prev; OnItemIndexChanged(item); OnItemIndexChanged(prev); return true; } else return false; } }
public bool StepDown(RenderingTask item) { lock (item) { int inx = mQueue.IndexOf(item); if (inx >= 0 && inx < mQueue.Count - 1) { RenderingTask next = mQueue[inx + 1]; mQueue[inx + 1] = item; mQueue[inx] = next; OnItemIndexChanged(item); OnItemIndexChanged(next); return true; } else return false; } }
public int IndexOf(RenderingTask item) { return mQueue.IndexOf(item); }
public RenderingTaskEventArgs(RenderingTask target) { _Target = target; }
protected virtual void OnItemIndexChanged(RenderingTask item) { if (ItemIndexChanged != null) ItemIndexChanged(this, new RenderingTaskEventArgs(item)); }
private void ProcessingThread() { mCancelItem = false; mCancelAllItems = false; OnThreadStarted(); while (!mThreadStopped) { if (mQueue.Count > 0) { try { mIsProcessingItem = true; RenderingTask cur_task = mQueue[0]; lock (cur_task) { if (mQueue.Contains(cur_task)) { lock (mQueue) { mInProgress = cur_task; mQueue.Remove(cur_task); OnItemRemoved(cur_task); } } } OnBeforeItemProcessingStarted(mInProgress); if (!mInProgress.Stage.LoadImage(mInProgress.Source, mInProgress.Prescale)) { throw new UserCancelException(); } mInProgress.Stage.Process(); OnQueueProgressMessageReport(mInProgress.Source, mInProgress.Destination, 1, "Saving image to file...", mInProgress.Stage.CurrentImage); OnItemRendering(mInProgress); OnQueueProgressMessageReport(mInProgress.Source, mInProgress.Destination, 1, "Image saved", mInProgress.Stage.CurrentImage); mInProgress.Stage.ProgressMessageReport -= HandleStageProgressMessageReport; OnAfterItemProcessingFinished(mInProgress); } catch (UserCancelException #if DEBUG exp #endif ) { #if DEBUG Console.WriteLine("User has sent " + exp.GetType().Name + " exception."); #endif } finally { mIsProcessingItem = false; mCancelItem = false; mCancelAllItems = false; if (mQueue.Count == 0) { OnQueueEmpty(); } } } else { Thread.Sleep(30); } } OnThreadStopped(); mWorkingThread = null; }
public int IndexOf(RenderingTask item) { return(mQueue.IndexOf(item)); }
protected virtual void OnAfterItemProcessingFinished(RenderingTask item) { if (AfterItemProcessingFinished != null) AfterItemProcessingFinished(this, new RenderingTaskEventArgs(item)); }
protected virtual void OnBeforeItemProcessingStarted(RenderingTask item) { if (BeforeItemProcessingStarted != null) BeforeItemProcessingStarted(this, new RenderingTaskEventArgs(item)); }
private void ProcessingThread() { mCancelItem = false; mCancelAllItems = false; OnThreadStarted(); while (!mThreadStopped) { if (mQueue.Count > 0) { try { mIsProcessingItem = true; RenderingTask cur_task = mQueue[0]; lock (cur_task) { if (mQueue.Contains(cur_task)) { lock (mQueue) { mInProgress = cur_task; mQueue.Remove(cur_task); OnItemRemoved(cur_task); } } } OnBeforeItemProcessingStarted(mInProgress); if (!mInProgress.Stage.LoadImage(mInProgress.Source, mInProgress.Prescale)) throw new UserCancelException(); mInProgress.Stage.Process(); OnQueueProgressMessageReport(mInProgress.Source, mInProgress.Destination, 1, "Saving image to file...", mInProgress.Stage.CurrentImage); OnItemRendering(mInProgress); OnQueueProgressMessageReport(mInProgress.Source, mInProgress.Destination, 1, "Image saved", mInProgress.Stage.CurrentImage); mInProgress.Stage.ProgressMessageReport -= HandleStageProgressMessageReport; OnAfterItemProcessingFinished(mInProgress); } catch (UserCancelException #if DEBUG exp #endif ) { #if DEBUG Console.WriteLine("User has sent " + exp.GetType().Name + " exception."); #endif } finally { mIsProcessingItem = false; mCancelItem = false; mCancelAllItems = false; if (mQueue.Count == 0) OnQueueEmpty(); } } else { Thread.Sleep(30); } } OnThreadStopped(); mWorkingThread = null; }
protected virtual void OnItemRendering(RenderingTask item) { if (ItemRendering != null) ItemRendering(this, new RenderingTaskEventArgs(item)); }
public RenderingTaskTreeNode(RenderingTask task) { mTask = task; }