private void CreateAnimationFrames() { this.animation_frames = new Drawing.Bitmap [] { SparkleUIHelpers.GetBitmap("process-syncing-i"), SparkleUIHelpers.GetBitmap("process-syncing-ii"), SparkleUIHelpers.GetBitmap("process-syncing-iii"), SparkleUIHelpers.GetBitmap("process-syncing-iiii"), SparkleUIHelpers.GetBitmap("process-syncing-iiiii") }; this.error_icon = SparkleUIHelpers.GetBitmap("process-syncing-error"); }
public SparkleStatusIcon() { this.syncing_idle_image = SparkleUIHelpers.GetBitmap("process-syncing-idle"); this.syncing_up_image = SparkleUIHelpers.GetBitmap("process-syncing-up"); this.syncing_down_image = SparkleUIHelpers.GetBitmap("process-syncing-down"); this.syncing_image = SparkleUIHelpers.GetBitmap("process-syncing"); this.syncing_error_image = SparkleUIHelpers.GetBitmap("process-syncing-error"); this.notify_icon.Icon = this.syncing_idle_image; this.notify_icon.HeaderText = "SparkleShare"; CreateMenu(); Controller.UpdateIconEvent += delegate(IconState state) { Dispatcher.BeginInvoke((Action) delegate { switch (state) { case IconState.Idle: { this.notify_icon.Icon = this.syncing_idle_image; break; } case IconState.SyncingUp: { this.notify_icon.Icon = this.syncing_up_image; break; } case IconState.SyncingDown: { this.notify_icon.Icon = this.syncing_down_image; break; } case IconState.Syncing: { this.notify_icon.Icon = this.syncing_image; break; } case IconState.Error: { this.notify_icon.Icon = this.syncing_error_image; break; } } }); }; Controller.UpdateStatusItemEvent += delegate(string state_text) { Dispatcher.BeginInvoke((Action) delegate { this.state_item.Header = state_text; this.state_item.UpdateLayout(); this.notify_icon.HeaderText = "SparkleShare\n" + state_text; }); }; Controller.UpdateMenuEvent += delegate(IconState state) { Dispatcher.BeginInvoke((Action) delegate { CreateMenu(); }); }; Controller.UpdateQuitItemEvent += delegate(bool item_enabled) { Dispatcher.BeginInvoke((Action) delegate { this.exit_item.IsEnabled = item_enabled; this.exit_item.UpdateLayout(); }); }; Controller.UpdateRecentEventsItemEvent += delegate(bool item_enabled) { Dispatcher.BeginInvoke((Action) delegate { this.log_item.IsEnabled = item_enabled; this.log_item.UpdateLayout(); }); }; }