当前位置: 首页 > 编程日记 > 正文

跟踪workflow instance 状态

场景是这样的:
1.workflowruntime启动了持久化和监听服务
2.workfllowruntime创建多个实例,并启动,一些会长时间延时,一些会中途暂停,会不同的执行状态(业务状态)
3.另有一winform控制台,有个表格,刷新显示每个实例的信息,包括业务状态--比如创建,运行,挂起等
4.通过workflowruntime.GetLoadedWorkflows()方法取得所有实例,但却没有办法得到正确的业务状态

当然,当将实例unload,再load后(实例回写到数据库),通过SqlTrackingQuery查询得到SqlTrackingWorkflowInstance.Status是可以.可是实际上,不可能一刷新实例表格就要将实例unload.所以,在想有没有办法在workflowruntime平台上,获取实例的业务状态. 
决定自己写个类,解决这个问题,思路如下:
1.在宿主中构建Dictionary<Guid, TrackingStatus>,用于维护instance状态
2.预订workflowruntime与instance相关的事件
3.在事件处理方法中更新instance对应的trackingstatus
4.定义event WorkflowStatusChangeEventHandler WorkflowStatusChanged事件,以便状态变化时处理

两个类:
ContractedBlock.gifExpandedBlockStart.gifTrackingStatus
 1None.gifusing System;
 2None.gifusing System.Collections.Generic;
 3None.gifusing System.Text;
 4None.gif
 5None.gifusing System.Workflow;
 6None.gifusing System.Workflow.Runtime;
 7None.gifusing System.Workflow.Runtime.Hosting;
 8None.gifusing System.Workflow.Runtime.Tracking;
 9None.gifusing System.Workflow.Activities;
10None.gifusing System.Workflow.ComponentModel;
11None.gif
12None.gifnamespace WFDebugger
13ExpandedBlockStart.gifContractedBlock.gifdot.gif{
14InBlock.gif    public class TrackingStatus
15ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
16InBlock.gif        private WorkflowInstance instance;
17InBlock.gif        private WorkflowStatus status;
18InBlock.gif        private DateTime lasteventtime;
19InBlock.gif
20InBlock.gif        public TrackingStatus(WorkflowInstance instance, WorkflowStatus status, System.DateTime eventtime)
21ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
22InBlock.gif            if (instance == null || eventtime == null)
23ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
24InBlock.gif                throw(new ArgumentNullException("instance|status|eventtime"));
25ExpandedSubBlockEnd.gif            }

26InBlock.gif            this.instance = instance;
27InBlock.gif            this.status = status;
28InBlock.gif            this.lasteventtime = eventtime;
29ExpandedSubBlockEnd.gif        }

30InBlock.gif
31InBlock.gif        public TrackingStatus(WorkflowInstance instance, WorkflowStatus status)
32ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
33InBlock.gif            if (instance == null)
34ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
35InBlock.gif                throw (new ArgumentNullException("instance|status|eventtime"));
36ExpandedSubBlockEnd.gif            }

37InBlock.gif            this.instance = instance;
38InBlock.gif            this.status = status;
39InBlock.gif            this.lasteventtime = DateTime.Now;
40ExpandedSubBlockEnd.gif        }

41InBlock.gif    
42InBlock.gif        public WorkflowInstance Instance
43ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
44InBlock.gif            get
45ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
46InBlock.gif                return instance;
47ExpandedSubBlockEnd.gif            }

48ExpandedSubBlockEnd.gif        }

49InBlock.gif
50InBlock.gif        public WorkflowStatus Status
51ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
52InBlock.gif            get
53ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
54InBlock.gif                return status;
55ExpandedSubBlockEnd.gif            }

56ExpandedSubBlockEnd.gif        }

57InBlock.gif
58InBlock.gif        public DateTime LastEventTime
59ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
60InBlock.gif            get
61ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
62InBlock.gif                return lasteventtime;
63ExpandedSubBlockEnd.gif            }

64ExpandedSubBlockEnd.gif        }

65InBlock.gif
66InBlock.gif        public void ChangeStatus(WorkflowStatus status, DateTime eventtime)
67ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
68InBlock.gif            if (!TryChangeStatus(status, eventtime,new TimeSpan(0,0,10)))
69ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
70InBlock.gif                throw(new Exception("can't lock variable"));
71ExpandedSubBlockEnd.gif            }

72ExpandedSubBlockEnd.gif        }

73InBlock.gif
74InBlock.gif        public void ChangeStatus(WorkflowStatus status)
75ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
76InBlock.gif            ChangeStatus(status, DateTime.Now);
77ExpandedSubBlockEnd.gif        }

78InBlock.gif
79InBlock.gif        public bool TryChangeStatus(WorkflowStatus status, DateTime eventtime,TimeSpan timeout)
80ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
81InBlock.gif            if (System.Threading.Monitor.TryEnter(this.status, timeout))
82ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
83InBlock.gif                this.status = status;
84InBlock.gif                lasteventtime = eventtime;
85InBlock.gif                return true;
86ExpandedSubBlockEnd.gif            }

87InBlock.gif            else
88ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
89InBlock.gif                return false;
90ExpandedSubBlockEnd.gif            }

91ExpandedSubBlockEnd.gif        }

92InBlock.gif        public bool TryChangeStatus(WorkflowStatus status, TimeSpan timeout)
93ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
94InBlock.gif            return TryChangeStatus(status,DateTime.Now, timeout);
95ExpandedSubBlockEnd.gif        }

96ExpandedSubBlockEnd.gif    }

97ExpandedBlockEnd.gif}

98None.gif
99None.gif

ContractedBlock.gifExpandedBlockStart.gifTrackingWorkflowEvent
  1None.gifusing System;
  2None.gifusing System.Collections;
  3None.gifusing System.Collections.Generic;
  4None.gifusing System.Data;
  5None.gif
  6None.gifusing System.Workflow;
  7None.gifusing System.Workflow.Runtime;
  8None.gifusing System.Workflow.Runtime.Hosting;
  9None.gifusing System.Workflow.Runtime.Tracking;
 10None.gifusing System.Workflow.Activities;
 11None.gifusing System.Workflow.ComponentModel;
 12None.gifusing System.Collections.ObjectModel;
 13None.gif
 14None.gif
 15None.gif
 16None.gifnamespace WFDebugger
 17ExpandedBlockStart.gifContractedBlock.gifdot.gif{
 18InBlock.gif    class TrackingWorkflowEvent:IDisposable     
 19ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
 20InBlock.gif
 21ContractedSubBlock.gifExpandedSubBlockStart.gif        事件#region 事件
 22InBlock.gif        public delegate void WorkflowStatusChangeEventHandler(object sender, WorkflowStatusChangeEventArgs e);
 23InBlock.gif        public event WorkflowStatusChangeEventHandler WorkflowStatusChanged;
 24InBlock.gif        void RaiseWorkflowStatusChangeEvent(WorkflowRuntime runtime,WorkflowStatusChangeEventArgs e)
 25ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 26InBlock.gif            if (WorkflowStatusChanged != null)
 27ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 28InBlock.gif                WorkflowStatusChanged.Invoke(runtime, e);
 29ExpandedSubBlockEnd.gif            }

 30ExpandedSubBlockEnd.gif        }

 31ExpandedSubBlockEnd.gif        #endregion

 32InBlock.gif
 33ContractedSubBlock.gifExpandedSubBlockStart.gif        私有变量#region 私有变量
 34InBlock.gif        private WorkflowRuntime workflowruntime;
 35InBlock.gif        private SqlTrackingService trackingservice;
 36InBlock.gif        private SqlWorkflowPersistenceService persistenceService;
 37InBlock.gif        private bool initialized = false;
 38InBlock.gif        private bool tacked = false;
 39InBlock.gif
 40InBlock.gif        private Dictionary<Guid, TrackingStatus> dic = new Dictionary<Guid, TrackingStatus>();
 41InBlock.gif
 42ExpandedSubBlockEnd.gif        #endregion

 43InBlock.gif
 44InBlock.gif        public TrackingWorkflowEvent(WorkflowRuntime workflowruntime)
 45ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 46InBlock.gif            if (workflowruntime != null)
 47ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 48InBlock.gif                this.workflowruntime = workflowruntime;
 49InBlock.gif                ReadOnlyCollection<SqlTrackingService> tcol = workflowruntime.GetAllServices<SqlTrackingService>();
 50InBlock.gif                if (tcol != null && tcol.Count > 0)
 51ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
 52InBlock.gif                    trackingservice = tcol[0];
 53ExpandedSubBlockEnd.gif                }

 54InBlock.gif                else
 55ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
 56InBlock.gif                    throw (new Exception("Workflowruntime havn't TrackingService."));
 57ExpandedSubBlockEnd.gif                }

 58InBlock.gif
 59InBlock.gif                ReadOnlyCollection<SqlWorkflowPersistenceService> pcol = workflowruntime.GetAllServices<SqlWorkflowPersistenceService>();
 60InBlock.gif                if (pcol != null && pcol.Count > 0)
 61ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
 62InBlock.gif                    persistenceService = pcol[0];
 63ExpandedSubBlockEnd.gif                }

 64InBlock.gif                else
 65ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
 66InBlock.gif                    throw (new Exception("Workflowruntime havn't WorkflowPersistenceService."));
 67ExpandedSubBlockEnd.gif                }

 68InBlock.gif
 69InBlock.gif                //runtime event
 70InBlock.gif                workflowruntimeStarted = new EventHandler<WorkflowRuntimeEventArgs>(workflowRuntime_Started);
 71InBlock.gif                workflowruntimeServicesExceptionNotHandled = new EventHandler<ServicesExceptionNotHandledEventArgs>(workflowRuntime_ServicesExceptionNotHandled);
 72InBlock.gif                workflowruntimeStopped = new EventHandler<WorkflowRuntimeEventArgs>(workflowRuntime_Stopped);
 73InBlock.gif
 74InBlock.gif                //instance event
 75InBlock.gif                workflowruntimeWorkflowCompleted = new EventHandler<WorkflowCompletedEventArgs>(workflowRuntime_WorkflowCompleted);
 76InBlock.gif                workflowruntimeWorkflowTerminated = new EventHandler<WorkflowTerminatedEventArgs>(workflowRuntime_WorkflowTerminated);
 77InBlock.gif                workflowruntimeWorkflowSuspended = new EventHandler<WorkflowSuspendedEventArgs>(workflowRuntime_WorkflowSuspended);
 78InBlock.gif                workflowruntimeWorkflowAborted = new EventHandler<WorkflowEventArgs>(workflowRuntime_WorkflowAborted);
 79InBlock.gif                workflowruntimeWorkflowResumed = new EventHandler<WorkflowEventArgs>(workflowRuntime_WorkflowResumed);
 80InBlock.gif                workflowruntimeWorkflowLoaded = new EventHandler<WorkflowEventArgs>(workflowRuntime_WorkflowLoaded);
 81InBlock.gif                workflowruntimeWorkflowIdled = new EventHandler<WorkflowEventArgs>(workflowRuntime_WorkflowIdled);
 82InBlock.gif                workflowruntimeWorkflowPersisted = new EventHandler<WorkflowEventArgs>(workflowRuntime_WorkflowPersisted);
 83InBlock.gif                workflowruntimeWorkflowUnloaded = new EventHandler<WorkflowEventArgs>(workflowRuntime_WorkflowUnloaded);
 84InBlock.gif                workflowruntimeWorkflowCreated = new EventHandler<WorkflowEventArgs>(workflowRuntime_WorkflowCreated);
 85InBlock.gif                workflowruntimeWorkflowStarted = new EventHandler<WorkflowEventArgs>(workflowRuntime_WorkflowStarted);
 86InBlock.gif
 87InBlock.gif                initialized = true;
 88ExpandedSubBlockEnd.gif            }

 89InBlock.gif            else
 90ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 91InBlock.gif                throw (new ArgumentNullException("workflowruntime"));
 92ExpandedSubBlockEnd.gif            }

 93ExpandedSubBlockEnd.gif        }

 94InBlock.gif
 95ContractedSubBlock.gifExpandedSubBlockStart.gif        私有方法#region 私有方法
 96InBlock.gif        private bool AddInstance(WorkflowInstance instance)
 97ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 98InBlock.gif            if (instance == null)
 99ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
100InBlock.gif                throw(new ArgumentNullException("instance"));
101ExpandedSubBlockEnd.gif            }

102InBlock.gif            if (instance.WorkflowRuntime != workflowruntime)
103ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
104InBlock.gif                throw (new Exception("different workflowruntime"));
105ExpandedSubBlockEnd.gif            }

106InBlock.gif            SqlTrackingQuery sq = new SqlTrackingQuery(trackingservice.ConnectionString);
107InBlock.gif            SqlTrackingWorkflowInstance sqi ;
108InBlock.gif            if (sq.TryGetWorkflow(instance.InstanceId, out sqi))
109ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
110InBlock.gif                dic.Add(instance.InstanceId, new TrackingStatus(instance, sqi.Status));
111InBlock.gif                RaiseWorkflowStatusChangeEvent(workflowruntime, new WorkflowStatusChangeEventArgs(instance,sqi.Status));
112InBlock.gif                return true;
113ExpandedSubBlockEnd.gif            }

114InBlock.gif            else
115InBlock.gif                return false;
116ExpandedSubBlockEnd.gif        }

117InBlock.gif        private bool AddInstance(WorkflowInstance instance,WorkflowStatus status)
118ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
119InBlock.gif            if (instance == null)
120ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
121InBlock.gif                throw (new ArgumentNullException("instance"));
122ExpandedSubBlockEnd.gif            }

123InBlock.gif            if (instance.WorkflowRuntime != workflowruntime)
124ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
125InBlock.gif                throw (new Exception("different workflowruntime"));
126ExpandedSubBlockEnd.gif            }

127InBlock.gif            dic.Add(instance.InstanceId, new TrackingStatus(instance, status));
128InBlock.gif            RaiseWorkflowStatusChangeEvent(workflowruntime, new WorkflowStatusChangeEventArgs(instance, status));
129InBlock.gif            return true;
130ExpandedSubBlockEnd.gif        }

131InBlock.gif
132InBlock.gif        private void RemoveInstance(WorkflowInstance instance)
133ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
134InBlock.gif            if (instance == null)
135ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
136InBlock.gif                throw (new ArgumentNullException("instance"));
137ExpandedSubBlockEnd.gif            }

138InBlock.gif            if (instance.WorkflowRuntime != workflowruntime)
139ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
140InBlock.gif                throw (new Exception("different workflowruntime"));
141ExpandedSubBlockEnd.gif            }

142InBlock.gif            RemoveInstance(instance.InstanceId);
143ExpandedSubBlockEnd.gif        }

144InBlock.gif        private void RemoveInstance(Guid instanceid)
145ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
146InBlock.gif            //if (instanceid == null)
147InBlock.gif            //{
148InBlock.gif            //    throw (new ArgumentNullException("instanceid"));
149InBlock.gif            //}
150InBlock.gif            if (dic.ContainsKey(instanceid))
151ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
152InBlock.gif                dic.Remove(instanceid);
153ExpandedSubBlockEnd.gif            }

154InBlock.gif            else
155ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
156InBlock.gif                throw (new Exception("no found appointed instance"));
157ExpandedSubBlockEnd.gif            }

158InBlock.gif
159InBlock.gif
160ExpandedSubBlockEnd.gif        }

161InBlock.gif        private bool ChangeStatus(WorkflowInstance instance, WorkflowStatus status)
162ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
163InBlock.gif            if (instance == null)
164ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
165InBlock.gif                throw (new ArgumentNullException("instance"));
166ExpandedSubBlockEnd.gif            }

167InBlock.gif            //if (status == null)
168InBlock.gif            //{
169InBlock.gif            //    throw (new ArgumentNullException("status"));
170InBlock.gif            //}
171InBlock.gif            if (dic.ContainsKey(instance.InstanceId))
172ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
173InBlock.gif                TrackingStatus ts = dic[instance.InstanceId];
174InBlock.gif                bool r = ts.TryChangeStatus(status,new TimeSpan(0,0,10));
175InBlock.gif                RaiseWorkflowStatusChangeEvent(workflowruntime, new WorkflowStatusChangeEventArgs(instance, status));
176InBlock.gif                return r;
177ExpandedSubBlockEnd.gif            }

178InBlock.gif            else
179ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
180InBlock.gif                return false;
181InBlock.gif                //return AddInstance(instance, status);
182ExpandedSubBlockEnd.gif            }

183InBlock.gif
184InBlock.gif
185ExpandedSubBlockEnd.gif        }

186ExpandedSubBlockEnd.gif        #endregion

187InBlock.gif
188ContractedSubBlock.gifExpandedSubBlockStart.gif        公开属性#region 公开属性
189ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
190InBlock.gif        /// 工作流环境
191ExpandedSubBlockEnd.gif        /// </summary>

192InBlock.gif        public WorkflowRuntime WorkflowRuntime
193ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
194InBlock.gif            get
195ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
196InBlock.gif                return workflowruntime;
197ExpandedSubBlockEnd.gif            }

198ExpandedSubBlockEnd.gif        }

199InBlock.gif
200ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
201InBlock.gif        /// 实例数量
202ExpandedSubBlockEnd.gif        /// </summary>

203InBlock.gif        public int Count
204ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
205InBlock.gif            get
206ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
207InBlock.gif                return dic.Count;
208ExpandedSubBlockEnd.gif            }

209ExpandedSubBlockEnd.gif        }

210InBlock.gif
211ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
212InBlock.gif        /// 是否在跟踪
213ExpandedSubBlockEnd.gif        /// </summary>

214InBlock.gif        public bool IsOnTracking
215ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
216InBlock.gif            get
217ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
218InBlock.gif                return tacked;
219ExpandedSubBlockEnd.gif            }

220ExpandedSubBlockEnd.gif        }

221ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
222InBlock.gif        /// 是否初始化
223ExpandedSubBlockEnd.gif        /// </summary>

224InBlock.gif        public bool Initialized
225ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
226InBlock.gif            get
227ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
228InBlock.gif                return initialized;
229ExpandedSubBlockEnd.gif            }

230ExpandedSubBlockEnd.gif        }

231InBlock.gif        public WorkflowStatus GetWorkflowStatus(Guid instanceID)
232ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
233InBlock.gif            //if (instanceID == null)
234InBlock.gif            //{
235InBlock.gif            //    throw(new ArgumentNullException("instanceID"));
236InBlock.gif            //}
237InBlock.gif            if (dic.ContainsKey(instanceID))
238ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
239InBlock.gif                return dic[instanceID].Status;
240ExpandedSubBlockEnd.gif            }

241InBlock.gif            else
242ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
243InBlock.gif                throw(new Exception("no found appointed instance"));
244InBlock.gif                //return AddInstance(instance, status);
245ExpandedSubBlockEnd.gif            }

246ExpandedSubBlockEnd.gif        }

247InBlock.gif        public WorkflowStatus GetWorkflowStatus(WorkflowInstance instance)
248ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
249InBlock.gif            if (instance == null)
250ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
251InBlock.gif                throw (new ArgumentNullException("instance"));
252ExpandedSubBlockEnd.gif            }

253InBlock.gif            if (instance.WorkflowRuntime != workflowruntime)
254ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
255InBlock.gif                throw (new Exception("different workflowruntime"));
256ExpandedSubBlockEnd.gif            }

257InBlock.gif            return GetWorkflowStatus(instance.InstanceId);
258ExpandedSubBlockEnd.gif        }

259InBlock.gif
260ExpandedSubBlockEnd.gif        #endregion
 
261InBlock.gif
262ContractedSubBlock.gifExpandedSubBlockStart.gif        Runtime Event#region Runtime Event
263InBlock.gif        
264ContractedSubBlock.gifExpandedSubBlockStart.gif        事件句柄#region 事件句柄
265InBlock.gif        //runtime event
266InBlock.gif        EventHandler<WorkflowRuntimeEventArgs>              workflowruntimeStarted;
267InBlock.gif        EventHandler<ServicesExceptionNotHandledEventArgs>  workflowruntimeServicesExceptionNotHandled;
268InBlock.gif        EventHandler<WorkflowRuntimeEventArgs>              workflowruntimeStopped;
269InBlock.gif
270InBlock.gif        //instance event
271InBlock.gif        EventHandler<WorkflowCompletedEventArgs>            workflowruntimeWorkflowCompleted;
272InBlock.gif        EventHandler<WorkflowTerminatedEventArgs>           workflowruntimeWorkflowTerminated;
273InBlock.gif        EventHandler<WorkflowSuspendedEventArgs>            workflowruntimeWorkflowSuspended;
274InBlock.gif        EventHandler<WorkflowEventArgs>                     workflowruntimeWorkflowAborted;
275InBlock.gif        EventHandler<WorkflowEventArgs>                     workflowruntimeWorkflowResumed;
276InBlock.gif        EventHandler<WorkflowEventArgs>                     workflowruntimeWorkflowLoaded;
277InBlock.gif        EventHandler<WorkflowEventArgs>                     workflowruntimeWorkflowIdled;
278InBlock.gif        EventHandler<WorkflowEventArgs>                     workflowruntimeWorkflowPersisted;
279InBlock.gif        EventHandler<WorkflowEventArgs>                     workflowruntimeWorkflowUnloaded;
280InBlock.gif        EventHandler<WorkflowEventArgs>                     workflowruntimeWorkflowCreated;
281InBlock.gif        EventHandler<WorkflowEventArgs>                     workflowruntimeWorkflowStarted;
282InBlock.gif
283InBlock.gif        public void TackEvent()
284ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
285InBlock.gif            if (initialized && !tacked)
286ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
287ContractedSubBlock.gifExpandedSubBlockStart.gif                预定事件#region 预定事件
288InBlock.gif                //runtime event
289InBlock.gif                workflowruntime.Started += workflowruntimeStarted;
290InBlock.gif                workflowruntime.ServicesExceptionNotHandled += workflowruntimeServicesExceptionNotHandled;
291InBlock.gif                workflowruntime.Stopped += workflowruntimeStopped;
292InBlock.gif
293InBlock.gif                //instance event
294InBlock.gif                workflowruntime.WorkflowCompleted += workflowruntimeWorkflowCompleted;
295InBlock.gif                workflowruntime.WorkflowTerminated += workflowruntimeWorkflowTerminated;
296InBlock.gif                workflowruntime.WorkflowSuspended += workflowruntimeWorkflowSuspended;
297InBlock.gif                workflowruntime.WorkflowAborted += workflowruntimeWorkflowAborted;
298InBlock.gif                workflowruntime.WorkflowResumed += workflowruntimeWorkflowResumed;
299InBlock.gif                workflowruntime.WorkflowLoaded += workflowruntimeWorkflowLoaded;
300InBlock.gif                workflowruntime.WorkflowIdled += workflowruntimeWorkflowIdled;
301InBlock.gif                workflowruntime.WorkflowPersisted += workflowruntimeWorkflowPersisted;
302InBlock.gif                workflowruntime.WorkflowUnloaded += workflowruntimeWorkflowUnloaded;
303InBlock.gif                workflowruntime.WorkflowCreated += workflowruntimeWorkflowCreated;
304InBlock.gif                workflowruntime.WorkflowStarted += workflowruntimeWorkflowStarted;
305ExpandedSubBlockEnd.gif                #endregion

306InBlock.gif                tacked = true;
307ExpandedSubBlockEnd.gif            }

308InBlock.gif            else
309ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
310InBlock.gif                thrownew Exception("TrackingWorkflowEvent didn't initialized or TrackingInstanceEvent tacked event"));
311ExpandedSubBlockEnd.gif            }

312ExpandedSubBlockEnd.gif        }

313InBlock.gif
314InBlock.gif        public void UntackEvent()
315ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
316InBlock.gif            if (initialized && tacked)
317ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
318ContractedSubBlock.gifExpandedSubBlockStart.gif                卸载事件#region 卸载事件
319InBlock.gif                //runtime event
320InBlock.gif                workflowruntime.Started -= workflowruntimeStarted;
321InBlock.gif                workflowruntime.ServicesExceptionNotHandled -= workflowruntimeServicesExceptionNotHandled;
322InBlock.gif                workflowruntime.Stopped -= workflowruntimeStopped;
323InBlock.gif
324InBlock.gif                //instance event
325InBlock.gif                workflowruntime.WorkflowCompleted -= workflowruntimeWorkflowCompleted;
326InBlock.gif                workflowruntime.WorkflowTerminated -= workflowruntimeWorkflowTerminated;
327InBlock.gif                workflowruntime.WorkflowSuspended -= workflowruntimeWorkflowSuspended;
328InBlock.gif                workflowruntime.WorkflowAborted -= workflowruntimeWorkflowAborted;
329InBlock.gif                workflowruntime.WorkflowResumed -= workflowruntimeWorkflowResumed;
330InBlock.gif                workflowruntime.WorkflowLoaded -= workflowruntimeWorkflowLoaded;
331InBlock.gif                workflowruntime.WorkflowIdled -= workflowruntimeWorkflowIdled;
332InBlock.gif                workflowruntime.WorkflowPersisted -= workflowruntimeWorkflowPersisted;
333InBlock.gif                workflowruntime.WorkflowUnloaded -= workflowruntimeWorkflowUnloaded;
334InBlock.gif                workflowruntime.WorkflowCreated -= workflowruntimeWorkflowCreated;
335InBlock.gif                workflowruntime.WorkflowStarted -= workflowruntimeWorkflowStarted;
336InBlock.gif
337ExpandedSubBlockEnd.gif                #endregion

338InBlock.gif
339InBlock.gif                tacked = false;
340ExpandedSubBlockEnd.gif            }

341InBlock.gif            else
342ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
343InBlock.gif                throw (new Exception("TrackingWorkflowEvent didn't initialized or TrackingInstanceEvent didn't tack event"));
344ExpandedSubBlockEnd.gif            }

345ExpandedSubBlockEnd.gif        }

346InBlock.gif        
347ExpandedSubBlockEnd.gif        #endregion

348InBlock.gif
349ContractedSubBlock.gifExpandedSubBlockStart.gif        事件处理#region 事件处理
350InBlock.gif
351ContractedSubBlock.gifExpandedSubBlockStart.gif        runtime event#region runtime event
352InBlock.gif        void workflowRuntime_Started(object sender, WorkflowRuntimeEventArgs e)
353ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
354InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow runtime started(启动)\tDateTime(时间) : {1}.{2}", e.IsStarted, DateTime.Now, DateTime.Now.Millisecond);
355ExpandedSubBlockEnd.gif        }

356InBlock.gif
357InBlock.gif        void workflowRuntime_ServicesExceptionNotHandled(object sender, ServicesExceptionNotHandledEventArgs e)
358ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
359InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow runtime services exception not handled(异常)[{0}]\tDateTime(时间) : {1}.{2}", e.Exception, DateTime.Now, DateTime.Now.Millisecond);
360ExpandedSubBlockEnd.gif        }

361InBlock.gif
362InBlock.gif        void workflowRuntime_Stopped(object sender, WorkflowRuntimeEventArgs e)
363ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
364InBlock.gif            dic.Clear();
365InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow runtime stopped(停止)\tDateTime(时间) : {1}.{2}", e.IsStarted, DateTime.Now, DateTime.Now.Millisecond);
366ExpandedSubBlockEnd.gif        }

367ExpandedSubBlockEnd.gif        #endregion
 runtime event
368InBlock.gif
369ContractedSubBlock.gifExpandedSubBlockStart.gif        instance event#region instance event
370InBlock.gif        void workflowRuntime_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
371ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
372InBlock.gif            ChangeStatus(e.WorkflowInstance, WorkflowStatus.Completed);
373InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tcompleted(完成)\tDateTime(时间) : {1}.{2}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond);
374ExpandedSubBlockEnd.gif        }

375InBlock.gif
376InBlock.gif        void workflowRuntime_WorkflowTerminated(object sender, WorkflowTerminatedEventArgs e)
377ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
378InBlock.gif            ChangeStatus(e.WorkflowInstance, WorkflowStatus.Terminated);
379InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tterminated(结束)\tDateTime(时间) : {1}.{2}\tmessage:{3}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond, e.Exception.Message);
380ExpandedSubBlockEnd.gif        }

381InBlock.gif
382InBlock.gif        void workflowRuntime_WorkflowSuspended(object sender, WorkflowSuspendedEventArgs e)
383ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
384InBlock.gif            ChangeStatus(e.WorkflowInstance, WorkflowStatus.Suspended);
385InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tsuspended(暂停)\tDateTime(时间) : {1}.{2}\tmessage:{3}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond, e.Error);
386ExpandedSubBlockEnd.gif        }

387InBlock.gif
388InBlock.gif        void workflowRuntime_WorkflowResumed(object sender, WorkflowEventArgs e)
389ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
390InBlock.gif            ChangeStatus(e.WorkflowInstance, WorkflowStatus.Running);
391InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tresumed(继续)\tDateTime(时间) : {1}.{2}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond);
392ExpandedSubBlockEnd.gif        }

393InBlock.gif
394InBlock.gif        void workflowRuntime_WorkflowAborted(object sender, WorkflowEventArgs e)
395ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
396InBlock.gif            ChangeStatus(e.WorkflowInstance, WorkflowStatus.Terminated);
397InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \taborted(中断)\tDateTime(时间) : {1}.{2}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond);
398ExpandedSubBlockEnd.gif        }

399InBlock.gif
400InBlock.gif        void workflowRuntime_WorkflowIdled(object sender, WorkflowEventArgs e)
401ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
402InBlock.gif            ChangeStatus(e.WorkflowInstance, WorkflowStatus.Running);
403InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tidled(空闲)\tDateTime(时间) : {1}.{2}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond);
404ExpandedSubBlockEnd.gif        }

405InBlock.gif
406InBlock.gif        void workflowRuntime_WorkflowUnloaded(object sender, WorkflowEventArgs e)
407ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
408InBlock.gif            RemoveInstance(e.WorkflowInstance);
409InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tunloaded(卸载)\tDateTime(时间) : {1}.{2}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond);
410ExpandedSubBlockEnd.gif        }

411InBlock.gif
412InBlock.gif        void workflowRuntime_WorkflowPersisted(object sender, WorkflowEventArgs e)
413ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
414InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tpersisted(持久)\tDateTime(时间) : {1}.{2}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond);
415ExpandedSubBlockEnd.gif        }

416InBlock.gif
417InBlock.gif        void workflowRuntime_WorkflowLoaded(object sender, WorkflowEventArgs e)
418ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
419InBlock.gif            AddInstance(e.WorkflowInstance);
420InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tloaded(加载)\tDateTime(时间) : {1}.{2}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond);
421ExpandedSubBlockEnd.gif        }

422InBlock.gif
423InBlock.gif        void workflowRuntime_WorkflowCreated(object sender, WorkflowEventArgs e)
424ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
425InBlock.gif            AddInstance(e.WorkflowInstance, WorkflowStatus.Created);
426InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tcreated(创建)\tDateTime(时间) : {1}.{2}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond);
427ExpandedSubBlockEnd.gif        }

428InBlock.gif
429InBlock.gif        void workflowRuntime_WorkflowStarted(object sender, WorkflowEventArgs e)
430ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
431InBlock.gif            ChangeStatus(e.WorkflowInstance, WorkflowStatus.Running);
432InBlock.gif            Console.WriteLine("TrackingWorkflowEvent: Workflow {0} \tstarted(启动)\tDateTime(时间) : {1}.{2}", e.WorkflowInstance.InstanceId, DateTime.Now, DateTime.Now.Millisecond);
433ExpandedSubBlockEnd.gif        }

434InBlock.gif
435InBlock.gif
436ExpandedSubBlockEnd.gif        #endregion
 instance event
437InBlock.gif
438InBlock.gif
439ExpandedSubBlockEnd.gif        #endregion
 事件处理
440InBlock.gif
441ExpandedSubBlockEnd.gif        #endregion

442InBlock.gif
443ContractedSubBlock.gifExpandedSubBlockStart.gif        IDisposable Members#region IDisposable Members
444InBlock.gif
445InBlock.gif        public void Dispose()
446ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
447InBlock.gif            if (dic != null)
448ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
449InBlock.gif                dic.Clear();
450InBlock.gif                dic = null;
451ExpandedSubBlockEnd.gif            }

452ExpandedSubBlockEnd.gif        }

453InBlock.gif
454ExpandedSubBlockEnd.gif        #endregion

455ExpandedSubBlockEnd.gif    }

456InBlock.gif
457ExpandedBlockEnd.gif}

使用方便:
            trackingworkflowevent = new TrackingWorkflowEvent(workflowRuntime);     //创建
            trackingworkflowevent.TackEvent();                                                          //预订事件
            trackingworkflowevent.GetWorkflowStatus(instance);                                       //获取instance状态
            trackingworkflowevent.UntackEvent();                                                     //卸载事件
            trackingworkflowevent.Dispose();                                                             //消毁


转载于:https://www.cnblogs.com/net66/archive/2006/10/26/541184.html

相关文章:

尝试Java,从入门到Kotlin(上)

之前一直使用C#开发&#xff0c;最近由于眼馋Java生态环境&#xff0c;并借着工作服务化改造的契机&#xff0c;直接将新项目的开发都转到Java上去。积攒些Java开发经验&#xff0c;应该对.NET开发也会有所启发和益处。 从理论上说&#xff0c;Java和C#语言差别不大&#xff0c…

Centos7状态下查看防火墙状态及修改服务端口

查看当前主机监听哪些服务端口 netstat -telunp查看防火墙firewall开放端口 fiewall-cmd --list-ports增加对外开放的端口 firewall-cmd --zonepublic --add-port8080/tcp --permanent扩充)关闭某个端口 firewall-cmd --permanent --remove-port8080/tcp重启防火墙 firewa…

VMWare中CentOS7 设置固定IP且能够访问外网

最近搭建kubernetes集群环境时遇到一个问题&#xff0c;CentOS7在重启后IP发生变化导致集群中etcd服务无法启动后集群环境变得不可用&#xff0c;针对这种情况&#xff0c;必须要对CentOS7设置固定IP且可以访问外网&#xff08;下载镜像用&#xff09;。 首先关闭VMware的DHCP&…

使用ASP.NET Atlas编写显示真实进度的ProgressBar(进度条)控件

当后台在进行某些长时间的操作时&#xff0c;如果能在页面上提供一个显示真实进度的进度条&#xff0c;而不是让用户不知情的等待或是从前的那些简单的估计&#xff0c;将是一个非常难得的出彩之处。现在使用ASP.NET Atlas完全有可能做到这些。这篇文章将讨论如何完成这一功能并…

初始化Mysql系统报错,begin failesd--conpilation aborted at scripts........

在编译安装Mysql之后进行初始化&#xff0c;但是出现了报错 初始化mysql scripts/mysql_install_db --basedir/usr/local/mysql --datadir/usr/local/mysql/data --usermysqlBEGIN failed–compilation aborted at scripts/mysql_install_db line 42 从报错的结果中看出Can…

asp.net Core多环境读取Json

IHostingEnviroment 获取环境相关洗洗 IsDevelopment()、IsStaging()、IsProduction() 分别为:开发、准生产、生产环境 IsEnviroment("Uat") 自定义环境,比如自定义Uat环境 新建: appsettings.Uat.json文件 {"Enviroment": "Uat" }Controller文件…

Microsoft Anti-Cross Site Scripting Library V1.5 发布了

Microsoft Anti-Cross Site Scripting Library V1.5 发布了 微软反跨站攻击脚本库 v1.5。此下载包含Microsoft Application Security Anti-Cross Site Scripting Library的分发组件.Anti-Cross Site Scripting Library可以为网站开发人员提供基于Web应用防护,以抵御源自 Cross-…

nodejs高版本转低版本

需要安装 第一步: npm install --save-dev babel-register npm install --save-dev babel-polyfill //由于只安装babel-register,无法解决低版本问题所以需要这个 npm install --save-dev babel-preset-latest //高版本到低版本js的一条路需要指定babelrc 最后需要创建文件: .b…

替换不文明词语和非法字符

//替换不文明词语和非法字符stringStrReplaceSk(stringcheckstr){ string repstr""; if(Application["repstr"] ! null) { repstr Application["repstr"].ToString(); } else { Uri myUri new Uri("http:…

BZOJ4568: [Scoi2016]幸运数字(线性基 倍增)

题意 题目链接 Sol 线性基是可以合并的 倍增维护一下 然后就做完了&#xff1f;&#xff1f; 喵喵喵&#xff1f; // luogu-judger-enable-o2 #include<bits/stdc.h> #define LL long long using namespace std; const int MAXN 2e4 10, B 60; inline LL read() {cha…

centos7给MySQL配置环境变量

centos7给MySQL配置环境变量 配置好了环境变量&#xff0c;就可以不用每次想要使用mysql时都要到/usr/local/mysql/bin&#xff0c;所以需要配置以下环境变量 编辑配置文件&#xff0c;加入环境变量 Vi /etc/profile在文件后面加上环境变量 export PATH$PATH:/usr/local/mys…

SQL2000联机丛书:使用和维护数据仓库

本次摘录 来源于SQL2000联机丛书中 创建和使用数据仓库概述为的是对数据仓库有个概观的认识使用数据仓库SQL 查询 --------- 最终用户很少使用结构化查询语言 (SQL) 查询直接访问数据仓库数据。 分析 SQL 查询很复杂&#xff0c;必须具有数据库专…

activiti自己定义流程之Spring整合activiti-modeler5.16实例(四):部署流程定义

注&#xff1a;&#xff08;1&#xff09;环境搭建&#xff1a;activiti自己定义流程之Spring整合activiti-modeler5.16实例&#xff08;一&#xff09;&#xff1a;环境搭建&#xff08;2&#xff09;创建流程模型&#xff1a;activiti自己定义流程之Spring整合activiti-model…

[rails] 我的订餐系统 -- 小试ruby on rails(转)

前言 近期在java社区中一种新的脚本语言ruby,及用ruby开发的一个wab框架 rails也热闹了起来.引起了不少的java开发人员的关注&#xff0e; 本人平时还是很少接触脚本语言方面东东,看到相关的评论例如: "习惯约定优于配置" -- 那样就用象java那样麻烦且繁杂…

DateReader,DateAdapter,DateSet和SqlCommand的基本使用方法

1usingSystem;2usingSystem.Data;3usingSystem.Data.SqlClient;45namespaceDemo36{ 7 /**//// <summary> 8 /// Class1 的摘要说明。 9 /// </summary>10 class Class111 {12 /**//// <summary>13 /// 应用程序的主入口点。14 /// </summary>15 [S…

JAVA实现长连接(含心跳检测)Demo

实现原理&#xff1a; 长连接的维持&#xff0c;是要客户端程序&#xff0c;定时向服务端程序&#xff0c;发送一个维持连接包的。 如果&#xff0c;长时间未发送维持连接包&#xff0c;服务端程序将断开连接。客户端&#xff1a; Client通过持有Socket的对象&…

java开发环境变量配置-JDK11-(win10),重启之后环境变量配置失效的解决办法

win10安装jdk11及环境变量配置 如果你之前已经安装过java的老版本的话&#xff0c;建议先卸载一下&#xff0c;同时删除掉环境变量的配置&#xff0c;这样比较容易一次性成成功&#xff0c;直接到设置里面应用程序找到java卸载就好 下载JDK11 直接附上官网链接&#xff1a;htt…

Activity启动流程图

转载于:https://www.cnblogs.com/dikeboy/p/10064610.html

sql 70-229 考试样题(1)

转&#xff1a;1&#xff0e;你是一数据公司的数据库开发者&#xff0c;你创建了一个用来存储15个不同高校运动会统计表的数据库。这些信息将被用在50家公司的网页设置上。每个公司的WEB设置以不同的格式来安排和显示这些统计表。你需要组装这些数据传送到这些公司去&#xff0…

HDU 5616 Jam's balance(01背包)

题目网址&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid5616 题目&#xff1a; Jams balance Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1810 Accepted Submission(s): 754 Problem Description…

datagrid DataFormatString

DataFormatString格式字符串 DataFormatString"{0:格式字符串}" 在DataFormatString 中的 {0} 表示数据本身&#xff0c;而在冒号后面的格式字符串代表所们希望数据显示的格式&#xff1b; 数字、货币格式&#xff1a;在指定的格式符号后可以指定小数所要显示的位数…

HashMap 和 Hashtable 的 6 个区别,最后一个没几个人知道!

HashMap 和 Hashtable 是 Java 开发程序员必须要掌握的&#xff0c;也是在各种 Java 面试场合中必须会问到的。 但你对这两者的区别了解有多少呢&#xff1f; 现在&#xff0c;栈长我给大家总结一下&#xff0c;或许有你不明朗的地方&#xff0c;在栈长的指点下都会拨开迷雾见晴…

自学笔记——Python内置的处理字符串的函数

序号函数描述1capitalize() 字符串的首字母变为大写2center&#xff08;width, fillchar&#xff09; 返回原来的字符串&#xff08;居中&#xff09;&#xff0c;并以空格填充至特定长度的字符串3count( str ,beg 0, end len(string) )计算出str在字符串中出现的字数&#x…

办公室28个经典赞美句子【转】

1.you look great today.&#xff08;你今天看上去很棒。&#xff09;【每天都可以用&#xff01;】2. you did a good job. &#xff08;你干得非常好。&#xff09;【国际最通用的表扬&#xff01;】3. we’re so proud of you.&#xff08;我们十分为你骄傲。&#xff09;【…

[源码和文档分享]基于java 的仿QQ聊天工具

一 需求分析 本系统是基于java开发的聊天室。有用户注册、用户登陆、修改密码、忘记密码、添加好友、用户聊天、群聊功能。如果服务器还没有启动&#xff0c;则客户端是不可以登陆、注册、忘记密码&#xff0c;如果在运行过程中&#xff0c;服务器断开则系统会有提示&#xff0…

错误: 编码 GBK 的不可映射字符 (0x80)

在我想要在命令行使用println输出一些中文的时候&#xff0c;发现编码出现错误 原因&#xff1a; java程序在编译的时候&#xff0c;需要使用JDK开发工具包中的JAVAC.EXE命令&#xff0c;而JDK开发工具包是国际版的&#xff0c;默认格式为UNICODE的编码格式。因此在默认情况下&…

HDU 2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活(多重背包)

传送门 Description 急&#xff01;灾区的食物依然短缺&#xff01;为了挽救灾区同胞的生命&#xff0c;心系灾区同胞的你准备自己采购一些粮食支援灾区&#xff0c;现在假设你一共有资金n元&#xff0c;而市场有m种大米&#xff0c;每种大米都是袋装产品&#xff0c;其价格不等…

A simple class to play sound on netcf (part 2)

在实际测试中发现上一片文章&#xff08;A simple class to play sound on netcf&#xff09;中介绍的播放声音的类在pda中运行正常&#xff0c;但却无法在pc中工作&#xff0c;简单分析了一下原因&#xff0c;发现是dll的问题&#xff0c;pc和pda播放声音时用的dll不同。pc中是…

SSL证书可以给多个域名使用吗?

欢迎访问网易云社区&#xff0c;了解更多网易技术产品运营经验从信任等级的角度来说&#xff0c;SSL证书主要分为三类&#xff1a;1.域名型https证书&#xff08;DVSSL&#xff09;:信任等级一般&#xff0c;只需验证网站的真实性便可颁发证书保护网站&#xff1b;2. 企业型htt…

ASP.NET性能调整之解决Server Too Busy错误

最近公司的一个ASP.NET站点频繁出现Server Too Busy错误&#xff0c;具体表现为页面响应慢、经常出现Server Too Busy异常&#xff1b;但实际上服务器的资源消耗却很低&#xff0c;CPU使用只有10%左右&#xff0c;非常奇怪。 该站点运行环境为Windows 2000&#xff0c;IIS5.0&a…