public override void ApplyLocalization() { if (_itemsToBackup != null) { _itemsToBackup.ApplyNewDegreesOfCompression(); } storeToolStripMenuItem.Text = LocalsHelper.ToString(CompressionDegree.Store); fastestToolStripMenuItem.Text = LocalsHelper.ToString(CompressionDegree.Fastest); fastToolStripMenuItem.Text = LocalsHelper.ToString(CompressionDegree.Fast); normalToolStripMenuItem.Text = LocalsHelper.ToString(CompressionDegree.Normal); maximumToolStripMenuItem.Text = LocalsHelper.ToString(CompressionDegree.Maximum); ultraToolStripMenuItem.Text = LocalsHelper.ToString(CompressionDegree.Ultra); itemsToCompressColumnHeader.Text = Translation.Current[418]; setCompressionDegreeToolStripMenuItem.Text = Translation.Current[417]; SetHintForControl(compressionItemsListView, Translation.Current[73]); SetHintForControl(addFoldersButton, Translation.Current[74]); addFoldersToolStripMenuItem.Text = Translation.Current[74]; SetHintForControl(removeCompressionItemButton, Translation.Current[77]); removeFromListToolStripMenuItem.Text = Translation.Current[77]; SetHintForControl(addFilesButton, Translation.Current[78]); addFilesToolStripMenuItem.Text = Translation.Current[78]; }
public void ApplyNewDegreesOfCompression() { _listView.BeginUpdate(); foreach (CompressionDegree degree in CompressionDegree.GetValues(typeof(CompressionDegree))) { _listView.Groups[(int)degree].Header = LocalsHelper.ToString(degree); } _listView.EndUpdate(); }
void LoadForm(object sender, EventArgs e) { // displaying the current settings settingsUserControl.SetSettingsToUi(_controller.Options, PowerTask.None, _task, false, ThreadPriority.BelowNormal); tasksListView.BeginUpdate(); ReadOnlyCollection <CompressionItem> items = _controller.ListOfFiles; foreach (CompressionItem item in items) { var listItem = new ListViewItem(item.Target, item.IsFolder ? (int)ImagesEnum.Folder : (int)ImagesEnum.File); listItem.SubItems.Add(LocalsHelper.ToString(item.CompressionDegree)); listItem.SubItems.Add(string.Empty); listItem.Group = item.IsFolder ? tasksListView.Groups[(int)GroupEnum.CompressionOfFolders] : tasksListView.Groups[(int)GroupEnum.CompressionOfFiles]; listItem.Tag = item; listItem.Checked = true; tasksListView.Items.Add(listItem); } foreach (StorageBase item in _task.Storages) { var listItem = new ListViewItem(item.StorageName); if (item is FtpStorage) { listItem.ImageIndex = (int)ImagesEnum.Ftp; } else if (item is HddStorage) { listItem.ImageIndex = (int)ImagesEnum.Hdd; } else if (item is NetworkStorage) { listItem.ImageIndex = (int)ImagesEnum.Network; } else { throw new NotImplementedException(item.GetType().ToString()); } listItem.SubItems.Add(item.Hint); listItem.SubItems.Add(string.Empty); listItem.Group = tasksListView.Groups[(int)GroupEnum.Storages]; listItem.Tag = item; listItem.Checked = true; tasksListView.Items.Add(listItem); } foreach (BackupEventTaskInfo taskInfo in _task.BeforeBackupTasksChain) { var listItem = new ListViewItem(taskInfo.Program); listItem.ImageIndex = (int)ImagesEnum.ProgramInRunBeforeAfterBackupChain; listItem.SubItems.Add(taskInfo.Arguments); listItem.SubItems.Add(string.Empty); listItem.Group = tasksListView.Groups[(int)GroupEnum.BeforeBackupChain]; listItem.Tag = taskInfo; listItem.Checked = true; tasksListView.Items.Add(listItem); } foreach (BackupEventTaskInfo taskInfo in _task.AfterBackupTasksChain) { var listItem = new ListViewItem(taskInfo.Program); listItem.ImageIndex = (int)ImagesEnum.ProgramInRunBeforeAfterBackupChain; listItem.SubItems.Add(taskInfo.Arguments); listItem.SubItems.Add(string.Empty); listItem.Group = tasksListView.Groups[(int)GroupEnum.AfterBackupChain]; listItem.Tag = taskInfo; listItem.Checked = true; tasksListView.Items.Add(listItem); } tasksListView.EndUpdate(); // logical verifying of settings // If they are not correct, just closing the Master if (items.Count == 0) { Messages.ShowInformationBox(Translation.Current[522]); Close(); } if (_task.Storages.Count < 1) { Messages.ShowInformationBox(Translation.Current[523]); Close(); } }
void OnNotificationReceived(object sender, EventArgs e) { if (InvokeRequired) { Invoke(new EventHandler(OnNotificationReceived), new [] { sender, e }); } else { if (e == null) { throw new InvalidOperationException(); } if (e is PackingNotificationEventArgs) { var notification = (PackingNotificationEventArgs)e; foreach (ListViewItem item in tasksListView.Items) { if (item.Tag == notification.Item) { item.SubItems[2].Text = LocalsHelper.ToString(notification.State); if (notification.State != ProcessingState.NotStarted) { item.BackColor = GetResultColor(notification.State); } } } } else if (e is CopyingToStorageNotificationEventArgs) { var notification = (CopyingToStorageNotificationEventArgs)e; foreach (ListViewItem item in tasksListView.Items) { if (item.Tag == notification.Storage) { item.SubItems[2].Text = LocalsHelper.ToString(notification.State); if (notification.State != ProcessingState.NotStarted) { item.BackColor = GetResultColor(notification.State); } } } } else if (e is ImagePackingNotificationEventArgs) { var notification = (ImagePackingNotificationEventArgs)e; foreach (ListViewItem item in tasksListView.Items) { if (item.Tag is string) { if ((string)item.Tag == ImagePacking) { item.SubItems[2].Text = LocalsHelper.ToString(notification.State); if (notification.State != ProcessingState.NotStarted) { item.BackColor = GetResultColor(notification.State); } } } } } else if (e is RunProgramBeforeOrAfterBackupEventArgs) { var notification = (RunProgramBeforeOrAfterBackupEventArgs)e; foreach (ListViewItem item in tasksListView.Items) { if (item.Tag is BackupEventTaskInfo) { if (item.Tag == notification.TaskInfo) { item.SubItems[2].Text = LocalsHelper.ToString(notification.State); if (notification.State != ProcessingState.NotStarted) { item.BackColor = GetResultColor(notification.State); } } } } } } }