Beispiel #1
0
        private void FormEditorShown(object sender, EventArgs e)
        {
            Text = "Character Editor v" + Program.Version;
            LoadCharacterDatabase();

            if (character == null)
            {
                Close();
                return;
            }

            dirtyWatcher = new DirtyWatcher(this);
            dirtyThread  = new Thread(obj =>
            {
                bool previousDirty = !dirtyWatcher.Dirty;

                while (!IsDisposed)
                {
                    lock (dirtyWatcher)
                    {
                        if (dirtyWatcher.Dirty != previousDirty && !dirtyWatcher.IgnoreDirtiness)
                        {
                            string title = "Character Editor v" + Program.Version + " [" + character.Name + "]";

                            if (dirtyWatcher.Dirty)
                            {
                                title += " *";
                            }

                            if (InvokeRequired)
                            {
                                Invoke(new MethodInvoker(() => Text = title));
                            }
                            else
                            {
                                Text = title;
                            }

                            previousDirty = dirtyWatcher.Dirty;
                        }
                        else if (dirtyWatcher.IgnoreDirtiness)
                        {
                            dirtyWatcher.Dirty = false;
                        }
                    }

                    Thread.Sleep(1);
                }
            });

            dirtyThread.Start();
        }
Beispiel #2
0
		private void FormEditorShown(object sender, EventArgs e)
		{
			Text = "Character Editor v" + Program.Version;
			LoadCharacterDatabase();

			if (character == null)
			{
				Close();
				return;
			}

			dirtyWatcher = new DirtyWatcher(this);
			dirtyThread = new Thread(obj =>
			{
				bool previousDirty = !dirtyWatcher.Dirty;

				while (!IsDisposed)
				{
					lock (dirtyWatcher)
					{
						if (dirtyWatcher.Dirty != previousDirty && !dirtyWatcher.IgnoreDirtiness)
						{
							string title = "Character Editor v" + Program.Version + " [" + character.Name + "]";

							if (dirtyWatcher.Dirty)
								title += " *";

							if (InvokeRequired)
								Invoke(new MethodInvoker(() => Text = title));
							else
								Text = title;

							previousDirty = dirtyWatcher.Dirty;
						}
						else if (dirtyWatcher.IgnoreDirtiness)
							dirtyWatcher.Dirty = false;
					}

					Thread.Sleep(1);
				}
			});

			dirtyThread.Start();
		}