public TaskElement(TaskElement copy, SelectTaskDialogWindow selectTaskDialogWindow) { InitializeComponent(); this.m_MainWindow = null; this.m_SelectTaskDialogWindow = selectTaskDialogWindow; this.m_ParentTask = copy.m_ParentTask; this.m_TaskID = copy.m_TaskID; this.m_IsCurrent = false; this.m_TaskElementState = TaskElementState.Normal; this.m_PreviousTaskElementState = m_TaskElementState; this.SetBackgroundBrush = TaskElement.m_NormalStateBrush; this.SetImageToImagePreviewElement(this.m_ParentTask.ThumbnailPath); this.SetTaskIDToLabel(this.m_TaskID); this.SetUtilityNameToLabel(this.m_ParentTask.UtilityName); this.SetFileNameToLabelAndToolTip(this.m_ParentTask.SrcFileName); this.SetTaskElementState(TaskElementState.Normal); this.MouseEnter += new MouseEventHandler(taskElement_MouseEnter); this.MouseLeave += new MouseEventHandler(taskElement_MouseLeave); this.MouseLeftButtonDown += new MouseButtonEventHandler(taskElement_MouseLeftButtonDown_SelectTaskDialog); this.image_SrcImagePreview.MouseEnter += new MouseEventHandler(Image_SrcImagePreview_MouseEnter); this.image_SrcImagePreview.MouseLeave += new MouseEventHandler(Image_SrcImagePreview_MouseLeave); Binding myBinding = new Binding(); myBinding.Path = new PropertyPath("SetBackgroundBrush"); myBinding.Mode = BindingMode.TwoWay; myBinding.Source = this; myBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; this.SetBinding(UserControl.BackgroundProperty, myBinding); }
public TaskElement(TaskElement copy, SelectTaskDialogWindow selectTaskDialogWindow) { InitializeComponent(); this.m_MainWindow = null; this.m_SelectTaskDialogWindow = selectTaskDialogWindow; this.m_ParentTask = copy.m_ParentTask; this.m_TaskID = copy.m_TaskID; this.m_IsCurrent = false; this.m_TaskElementState = TaskElementState.Normal; this.m_PreviousTaskElementState = m_TaskElementState; this.SetBackgroundBrush = TaskElement.m_NormalStateBrush; this.SetImageToImagePreviewElement(this.m_ParentTask.ThumbnailPath); this.SetTaskIDToLabel(this.m_TaskID); this.SetUtilityNameToLabel(this.m_ParentTask.UtilityName); this.SetFileNameToLabelAndToolTip(this.m_ParentTask.SrcFileName); this.SetTaskElementState(TaskElementState.Normal); this.MouseEnter += new MouseEventHandler(taskElement_MouseEnter); this.MouseLeave += new MouseEventHandler(taskElement_MouseLeave); this.MouseLeftButtonDown += new MouseButtonEventHandler(taskElement_MouseLeftButtonDown_SelectTaskDialog); this.image_SrcImagePreview.MouseEnter += new MouseEventHandler(Image_SrcImagePreview_MouseEnter); this.image_SrcImagePreview.MouseLeave += new MouseEventHandler(Image_SrcImagePreview_MouseLeave); Binding myBinding = new Binding(); myBinding.Path = new PropertyPath("SetBackgroundBrush"); myBinding.Mode = BindingMode.TwoWay; myBinding.Source = this; myBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; this.SetBinding(UserControl.BackgroundProperty, myBinding); }
private void Button_BrowseInputFile_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = m_InputFilter; SelectTaskDialogWindow selectTaskDialogWindow = new SelectTaskDialogWindow(m_MainWindow.GetTasksList); switch (m_CurrentMode) { case InputMode.OneFile: openFileDialog. Multiselect = false; openFileDialog.CheckPathExists = true; if (openFileDialog.ShowDialog() == true) { m_InputFiles.AddRange(openFileDialog.FileNames); ListBox_SelectedFiles.Items.Clear(); ListBox_SelectedFiles.ItemsSource = m_InputFiles; /* foreach (string fileName in m_InputFiles) { ListBox_SelectedFiles.Items.Add(fileName); } */ if (Properties.Settings.Default.GenerateThumbnails == true) { MakeThumbnails(); } TextBox_InputFile.Text = m_InputFiles[0]; } break; case InputMode.MultipleFilesForOneTask: openFileDialog.Multiselect = true; openFileDialog.CheckPathExists = true; if (openFileDialog.ShowDialog() == true) { m_InputFiles.AddRange(openFileDialog.FileNames); ListBox_SelectedFiles.Items.Clear(); ListBox_SelectedFiles.ItemsSource = m_InputFiles; /* foreach (string fileName in m_InputFiles) { ListBox_SelectedFiles.Items.Add(fileName); } */ if (Properties.Settings.Default.GenerateThumbnails == true) { MakeThumbnails(); } foreach (string file in m_InputFiles) { TextBox_InputFile.Text += file + "; "; } } break; case InputMode.MultipleFilesForMultipleTasks: openFileDialog.Multiselect = true; openFileDialog.CheckPathExists = true; if (openFileDialog.ShowDialog() == true) { m_InputFiles.AddRange(openFileDialog.FileNames); ListBox_SelectedFiles.Items.Clear(); ListBox_SelectedFiles.ItemsSource = m_InputFiles; /* foreach (string fileName in m_InputFiles) { ListBox_SelectedFiles.Items.Add(fileName); } */ if (Properties.Settings.Default.GenerateThumbnails == true) { MakeThumbnails(); } foreach (string file in m_InputFiles) { TextBox_InputFile.Text += file + "; "; } } break; case InputMode.FromAnotherTasksForOneTask: if (selectTaskDialogWindow.ShowDialog() == true) { m_InputFiles.AddRange(selectTaskDialogWindow.FileNames); ListBox_SelectedFiles.Items.Clear(); ListBox_SelectedFiles.ItemsSource = m_InputFiles; /* foreach (string fileName in m_InputFiles) { ListBox_SelectedFiles.Items.Add(fileName); } */ } break; case InputMode.FromAnotherTasksForMultipleTasks: if (selectTaskDialogWindow.ShowDialog() == true) { m_InputFiles.AddRange(selectTaskDialogWindow.FileNames); ListBox_SelectedFiles.Items.Clear(); ListBox_SelectedFiles.ItemsSource = m_InputFiles; /* foreach (string fileName in m_InputFiles) { ListBox_SelectedFiles.Items.Add(fileName); } */ } break; } }