/// <summary> /// Prepare the event data and safely invoke TrayTextNotification /// </summary> /// <param name="m"></param> /// <param name="name"></param> public static void ChangeTrayText(MessageType m, string name = null) { var args = new TrayTextNotificationArgs { AssossiatedFile = name, MessageType = m }; TrayTextNotification.SafeInvoke(null, args); }
/// <summary> /// Prepare the event data and safely invoke TrayTextNotification /// </summary> /// <param name="m"></param> /// <param name="name"></param> public static void ChangeTrayText(MessageType m, string name = null, long size = 0, string custom = null) { var args = new TrayTextNotificationArgs { AssossiatedFile = name, MessageType = m, sizeValue = size, customString = custom }; TrayTextNotification.SafeInvoke(null, args); }
public fTrayForm() { InitializeComponent(); Notifications.TrayTextNotification += (o, n) => { if (IsHandleCreated) Invoke(new MethodInvoker(() => SetStatusLabel(o, n))); else _lastStatus = n; }; // Make status label same color as the icons lCurrentStatus.ForeColor = Color.FromArgb(105, 105, 105); }
/// <summary> /// Prepare the event data and safely invoke TrayTextNotification /// </summary> /// <param name="m"></param> /// <param name="name"></param> public static void ChangeTrayText(MessageType m, string name = null) { var args = new TrayTextNotificationArgs(m, name); TrayTextNotification.SafeInvoke(null, args); }
/// <summary> /// Prepare the event data and safely invoke TrayTextNotification /// </summary> /// <param name="m"></param> /// <param name="name"></param> public static void ChangeTrayText(MessageType m, string name = null) { var args = new TrayTextNotificationArgs { AssossiatedFile = name, MessageType = m }; if (TrayTextNotification != null) TrayTextNotification(null, args); }
public void SetTray(object o, TrayTextNotificationArgs e) { try { // Save latest tray status _lastTrayStatus = e; switch (e.MessageType) { case MessageType.Connecting: case MessageType.Reconnecting: case MessageType.Syncing: tray.Icon = Resources.syncing; tray.Text = Common.Languages[e.MessageType]; break; case MessageType.Uploading: case MessageType.Downloading: tray.Icon = Resources.syncing; tray.Text = Common.Languages[MessageType.Syncing]; break; case MessageType.AllSynced: case MessageType.Ready: tray.Icon = Resources.AS; tray.Text = Common.Languages[e.MessageType]; break; case MessageType.Offline: case MessageType.Disconnected: tray.Icon = Resources.offline1; tray.Text = Common.Languages[e.MessageType]; break; case MessageType.Listing: tray.Icon = Resources.AS; tray.Text = (Program.Account.Account.SyncMethod == SyncMethod.Automatic) ? Common.Languages[MessageType.AllSynced] : Common.Languages[MessageType.Listing]; break; case MessageType.Nothing: tray.Icon = Resources.ftpboxnew; tray.Text = Common.Languages[e.MessageType]; break; } } catch (Exception ex) { Common.LogError(ex); } }
public void SetTray(object o, TrayTextNotificationArgs e) { try { // Save latest tray status _lastTrayStatus = e; string msg = null; if (!string.IsNullOrWhiteSpace(e.AssossiatedFile)) { string name = e.AssossiatedFile; // Shorten long names to be all cool with the stupid 64-character limit if (name.Length >= 15) name = string.Format("{0}...{1}",name.Substring(0,7), name.Substring(name.Length-5)); msg = (e.MessageType == MessageType.Uploading) ? string.Format(Common.Languages[MessageType.Uploading], name) : string.Format(Common.Languages[MessageType.Downloading], name); } switch (e.MessageType) { case MessageType.Uploading: tray.Icon = Properties.Resources.syncing; tray.Text = msg ?? Common.Languages[MessageType.Syncing]; break; case MessageType.Downloading: tray.Icon = Properties.Resources.syncing; tray.Text = msg ?? Common.Languages[MessageType.Syncing]; break; case MessageType.AllSynced: tray.Icon = Properties.Resources.AS; tray.Text = Common.Languages[MessageType.AllSynced]; break; case MessageType.Syncing: tray.Icon = Properties.Resources.syncing; tray.Text = Common.Languages[MessageType.Syncing]; break; case MessageType.Offline: tray.Icon = Properties.Resources.offline1; tray.Text = Common.Languages[MessageType.Offline]; break; case MessageType.Listing: tray.Icon = Properties.Resources.AS; tray.Text = (Program.Account.Account.SyncMethod == SyncMethod.Automatic) ? Common.Languages[MessageType.AllSynced] : Common.Languages[MessageType.Listing]; break; case MessageType.Connecting: tray.Icon = Properties.Resources.syncing; tray.Text = Common.Languages[MessageType.Connecting]; break; case MessageType.Disconnected: tray.Icon = Properties.Resources.offline1; tray.Text = Common.Languages[MessageType.Disconnected]; break; case MessageType.Reconnecting: tray.Icon = Properties.Resources.syncing; tray.Text = Common.Languages[MessageType.Reconnecting]; break; case MessageType.Ready: tray.Icon = Properties.Resources.AS; tray.Text = Common.Languages[MessageType.Ready]; break; case MessageType.Nothing: tray.Icon = Properties.Resources.ftpboxnew; tray.Text = Common.Languages[MessageType.Nothing]; break; } } catch (Exception ex) { Common.LogError(ex); } }
public void SetTray(object o, TrayTextNotificationArgs e) { try { string msg = null; if (!string.IsNullOrWhiteSpace(e.AssossiatedFile)) { _lastTrayStatus = MessageType.Syncing; msg = (e.MessageType == MessageType.Uploading) ? string.Format(Common._(MessageType.Uploading), e.AssossiatedFile) : string.Format(Common._(MessageType.Downloading), e.AssossiatedFile); if (msg.Length > 64) msg = msg.Substring(0, 54) + "..." + msg.Substring(msg.Length - 5); } switch (e.MessageType) { case MessageType.Uploading: tray.Icon = Properties.Resources.syncing; tray.Text = msg ?? Common._(MessageType.Syncing); break; case MessageType.Downloading: tray.Icon = Properties.Resources.syncing; tray.Text = msg ?? Common._(MessageType.Syncing); break; case MessageType.AllSynced: tray.Icon = Properties.Resources.AS; tray.Text = Common._(MessageType.AllSynced); _lastTrayStatus = MessageType.AllSynced; break; case MessageType.Syncing: tray.Icon = Properties.Resources.syncing; tray.Text = Common._(MessageType.Syncing); _lastTrayStatus = MessageType.Syncing; break; case MessageType.Offline: tray.Icon = Properties.Resources.offline1; tray.Text = Common._(MessageType.Offline); _lastTrayStatus = MessageType.Offline; break; case MessageType.Listing: tray.Icon = Properties.Resources.AS; tray.Text = (Profile.SyncingMethod == SyncMethod.Automatic) ? Common._(MessageType.AllSynced) : Common._(MessageType.Listing); _lastTrayStatus = MessageType.Listing; break; case MessageType.Connecting: tray.Icon = Properties.Resources.syncing; tray.Text = Common._(MessageType.Connecting); _lastTrayStatus = MessageType.Connecting; break; case MessageType.Disconnected: tray.Icon = Properties.Resources.syncing; tray.Text = Common._(MessageType.Disconnected); _lastTrayStatus = MessageType.Disconnected; break; case MessageType.Reconnecting: tray.Icon = Properties.Resources.syncing; tray.Text = Common._(MessageType.Reconnecting); _lastTrayStatus = MessageType.Reconnecting; break; case MessageType.Ready: tray.Icon = Properties.Resources.AS; tray.Text = Common._(MessageType.Ready); _lastTrayStatus = MessageType.Ready; break; case MessageType.Nothing: tray.Icon = Properties.Resources.ftpboxnew; tray.Text = Common._(MessageType.Nothing); _lastTrayStatus = MessageType.Nothing; break; } } catch (Exception ex) { Common.LogError(ex); } }
public void SetStatusLabel(object o, TrayTextNotificationArgs e) { try { // Save latest status _lastStatus = e; if (!string.IsNullOrWhiteSpace(e.AssossiatedFile)) { var name = Common._name(e.AssossiatedFile); var format = Common.Languages[e.MessageType]; _transferItem.FileNameLabel = name; _transferItem.SubTitleFormat = format; _transferItem.FileStatusLabel = string.Format(format, string.Empty); // Add to top of recent list fRecentList.Controls.Add(_transferItem); fRecentList.Controls.SetChildIndex(_transferItem, 0); } switch (e.MessageType) { case MessageType.Uploading: case MessageType.Downloading: lCurrentStatus.Text = Common.Languages[MessageType.Syncing]; break; case MessageType.Listing: lCurrentStatus.Text = (Program.Account.Account.SyncMethod == SyncMethod.Automatic) ? Common.Languages[MessageType.AllSynced] : Common.Languages[MessageType.Listing]; break; default: lCurrentStatus.Text = Common.Languages[e.MessageType]; break; } // Remove 'FTPbox - ' from the beginning of the label if (lCurrentStatus.Text.StartsWith("FTPbox - ")) lCurrentStatus.Text = lCurrentStatus.Text.Substring("FTPbox - ".Length); } catch (Exception ex) { Common.LogError(ex); } }