// Конструкторы #region Конструкторы public MainWindow() { InitializeComponent(); this.WindowStartupLocation = WindowStartupLocation.CenterScreen; m_Tasks = new ObservableCollection<MyTask>(); m_TasksCounter = 0; m_CurrentTask = null; m_OutputStringBuilder = new MyStringBuilder(); m_StatusBarMessage = String.Empty; //m_CurrentTaskId = 0; //m_NumOfTasksToComplete = 0; Properties.Settings.Default.TempDirectory = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "GDAL_GUI_TEMP_THUMBNAILS"); System.IO.Directory.CreateDirectory(Properties.Settings.Default.TempDirectory); TaskManager.InitializeProcessManager(this); TaskManager.SetDataReceivedHandler = OutputDataRecieved; // Привязка StringBuilder к TextBlock Binding myBinding = new Binding(); myBinding.Path = new PropertyPath("Text"); myBinding.Mode = BindingMode.OneWay; myBinding.Source = m_OutputStringBuilder; myBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; TextBox_OutputData.SetBinding(TextBox.TextProperty, myBinding); Binding myBindingStatusBar = new Binding(); myBindingStatusBar.Path = new PropertyPath("StatusBarMessage"); myBindingStatusBar.Mode = BindingMode.TwoWay; myBindingStatusBar.Source = this; myBindingStatusBar.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; //StatusBar_Label.SetBinding(Label.ContentProperty, myBindingStatusBar); StatusBar_TextBlock.SetBinding(TextBlock.TextProperty, myBindingStatusBar); Binding myBindingProgressBar = new Binding(); myBindingProgressBar.Path = new PropertyPath("ProgressBarValue"); myBindingProgressBar.Mode = BindingMode.TwoWay; myBindingProgressBar.Source = this; myBindingProgressBar.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; StatusBar_ProgressBar.SetBinding(ProgressBar.ValueProperty, myBindingProgressBar); Binding myBindingCurrentTaskIdTextBlock = new Binding(); myBindingCurrentTaskIdTextBlock.Path = new PropertyPath("StatusBarCurrentTaskId"); myBindingCurrentTaskIdTextBlock.Mode = BindingMode.TwoWay; myBindingCurrentTaskIdTextBlock.Source = this; myBindingCurrentTaskIdTextBlock.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; StatusBar_TextBlock_CurrentTaskId.SetBinding(TextBlock.TextProperty, myBindingCurrentTaskIdTextBlock); Binding myBindingNumOfTasksToComplete = new Binding(); myBindingNumOfTasksToComplete.Path = new PropertyPath("StatusBarNumOfTasksToComplete"); myBindingNumOfTasksToComplete.Mode = BindingMode.TwoWay; myBindingNumOfTasksToComplete.Source = this; myBindingNumOfTasksToComplete.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; StatusBar_TextBlock_NumOfTasksToComplete.SetBinding(TextBlock.TextProperty, myBindingNumOfTasksToComplete); EventAndPropertiesInitialization(); }
// Конструкторы #region Конструкторы public MainWindow() { InitializeComponent(); this.WindowStartupLocation = WindowStartupLocation.CenterScreen; m_Tasks = new ObservableCollection <MyTask>(); m_TasksCounter = 0; m_CurrentTask = null; m_OutputStringBuilder = new MyStringBuilder(); m_StatusBarMessage = String.Empty; //m_CurrentTaskId = 0; //m_NumOfTasksToComplete = 0; Properties.Settings.Default.TempDirectory = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "GDAL_GUI_TEMP_THUMBNAILS"); System.IO.Directory.CreateDirectory(Properties.Settings.Default.TempDirectory); TaskManager.InitializeProcessManager(this); TaskManager.SetDataReceivedHandler = OutputDataRecieved; // Привязка StringBuilder к TextBlock Binding myBinding = new Binding(); myBinding.Path = new PropertyPath("Text"); myBinding.Mode = BindingMode.OneWay; myBinding.Source = m_OutputStringBuilder; myBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; TextBox_OutputData.SetBinding(TextBox.TextProperty, myBinding); Binding myBindingStatusBar = new Binding(); myBindingStatusBar.Path = new PropertyPath("StatusBarMessage"); myBindingStatusBar.Mode = BindingMode.TwoWay; myBindingStatusBar.Source = this; myBindingStatusBar.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; //StatusBar_Label.SetBinding(Label.ContentProperty, myBindingStatusBar); StatusBar_TextBlock.SetBinding(TextBlock.TextProperty, myBindingStatusBar); Binding myBindingProgressBar = new Binding(); myBindingProgressBar.Path = new PropertyPath("ProgressBarValue"); myBindingProgressBar.Mode = BindingMode.TwoWay; myBindingProgressBar.Source = this; myBindingProgressBar.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; StatusBar_ProgressBar.SetBinding(ProgressBar.ValueProperty, myBindingProgressBar); Binding myBindingCurrentTaskIdTextBlock = new Binding(); myBindingCurrentTaskIdTextBlock.Path = new PropertyPath("StatusBarCurrentTaskId"); myBindingCurrentTaskIdTextBlock.Mode = BindingMode.TwoWay; myBindingCurrentTaskIdTextBlock.Source = this; myBindingCurrentTaskIdTextBlock.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; StatusBar_TextBlock_CurrentTaskId.SetBinding(TextBlock.TextProperty, myBindingCurrentTaskIdTextBlock); Binding myBindingNumOfTasksToComplete = new Binding(); myBindingNumOfTasksToComplete.Path = new PropertyPath("StatusBarNumOfTasksToComplete"); myBindingNumOfTasksToComplete.Mode = BindingMode.TwoWay; myBindingNumOfTasksToComplete.Source = this; myBindingNumOfTasksToComplete.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; StatusBar_TextBlock_NumOfTasksToComplete.SetBinding(TextBlock.TextProperty, myBindingNumOfTasksToComplete); EventAndPropertiesInitialization(); }