Banshee プロジェクトの「SeekSlider」ウィジェットのコードから作成した Monodevelop gtk# Toolbox アイテム .dll を使用しようとしています。コードは正常にコンパイルされ、Monodevelop のツールボックスに追加でき、SeekSlider ウィジェットをフォームにドロップできますが、そのコードをコンパイルすると CS1729 がスローされます。以下はコードです。私はこれに困惑しています。提供できるヘルプがあれば大歓迎です。
using System;
using Gtk;
using Mono.Unix;
namespace SeekSlider
{
[System.ComponentModel.ToolboxItem(true)]
public class SeekSlider : HScale
{
private uint timeout;
private uint timeout_delay = 500;
private bool can_seek;
private bool raise_seek_requested;
private bool can_set_value;
private double pressed_x;
public event EventHandler SeekRequested;
public event EventHandler DurationChanged;
public SeekSlider () : base (0.0, 0.0, 0.0)
{
UpdatePolicy = UpdateType.Continuous;
DrawValue = false;
raise_seek_requested = true;
can_set_value = true;
Adjustment.Lower = 0;
Adjustment.Upper = 0;
Accessible.Name = Catalog.GetString ("Seek");
SetIdle ();
}
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
can_set_value = false;
if (evnt.Button == 1) {
pressed_x = evnt.X;
}
return base.OnButtonPressEvent (evnt);
}
protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
{
switch (evnt.Key) {
case Gdk.Key.Left:
case Gdk.Key.Right:
return false;
default:
return base.OnKeyPressEvent (evnt);
}
}
protected override bool OnScrollEvent (Gdk.EventScroll evnt) {
if (can_seek) {
SeekValue += (evnt.Direction.Equals (Gdk.ScrollDirection.Down) ? -1 : 1) * 10000; // skip 10s
OnSeekRequested ();
}
return base.OnScrollEvent (evnt);
}
protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt)
{
can_set_value = true;
if (timeout > 0) {
GLib.Source.Remove (timeout);
}
if (can_seek) {
if (evnt.Button == 1 && Math.Abs (pressed_x - evnt.X) <= 3.0) {
SeekValue = (long) (evnt.X / Allocation.Width * Duration); // seek to clicked position
}
OnSeekRequested ();
}
return base.OnButtonReleaseEvent (evnt);
}
protected override void OnValueChanged ()
{
if (timeout == 0 && raise_seek_requested) {
timeout = GLib.Timeout.Add (timeout_delay, OnSeekRequested);
}
base.OnValueChanged ();
}
private bool OnSeekRequested ()
{
if (raise_seek_requested) {
EventHandler handler = SeekRequested;
if (handler != null) {
handler (this, new EventArgs ());
}
}
timeout = 0;
return false;
}
public long SeekValue {
get { return (long)Value; }
set {
if (!can_set_value) {
return;
}
raise_seek_requested = false;
if (value > Duration) {
Duration = Int64.MaxValue;
Value = value;
} else {
Value = value;
}
raise_seek_requested = true;
}
}
public double Duration {
get { return Adjustment.Upper; }
set {
Adjustment.Upper = value;
EventHandler handler = DurationChanged;
if (handler != null) {
handler (this, EventArgs.Empty);
}
}
}
public void SetIdle ()
{
Sensitive = false;
SeekValue = 0;
Duration = 0;
}
public uint SeekRequestDelay {
get { return timeout_delay; }
set { timeout_delay = value; }
}
public bool CanSeek {
get { return can_seek; }
set {
can_seek = value;
Sensitive = value;
}
}
public new bool Sensitive {
get { return base.Sensitive; }
set {
if (!value) {
can_set_value = true;
}
base.Sensitive = value;
}
}
}
}