private void WindowsTaskStatus_Click(object sender, RoutedEventArgs e)
        {
            View.TaskView taskView = (View.TaskView)MainDataGrid.DataContext;

            TaskStatusWindow window = new TaskStatusWindow();

            BindingList<Models.Task> taskModel = taskView.TaskModel;
            BindingList<Models.TaskStatus> taskStatus = taskView.TaskStatus;
            BindingList<Models.TaskStatus> taskStatusNew = new BindingList<Models.TaskStatus>();
            View.StatusTaskView statusTaskView = (View.StatusTaskView)window.DataContext;
            foreach (Models.Task task in taskModel)
            {
                ObservableCollection<AnalizeTask.Models.TaskStatus> filtererdTests;
                filtererdTests = new ObservableCollection<Models.TaskStatus>(taskStatus.Where(t => t.Id == task.StatusId));
                if (statusTaskView.TaskStatus == null)
                    statusTaskView.TaskStatus = new BindingList<Models.TaskStatus>();
                statusTaskView.TaskStatus.Add(new Models.TaskStatus() { Name = filtererdTests[0].Name, Description = filtererdTests[0].Description, Id = filtererdTests[0].Id, ImageUrl = filtererdTests[0].ImageUrl, ImageUrl24 = filtererdTests[0].ImageUrl24 });
            }

            window.ShowDialog();
        }
        private void MarkStatus_Click(object sender, RoutedEventArgs e)
        {
            View.TaskView taskView = (View.TaskView)MainDataGrid.DataContext;

            TaskStatusWindow window = new TaskStatusWindow();

            BindingList<Models.Task> taskModel = taskView.TaskModel;
            Models.Task task = (Models.Task)MainDataGrid.Items[MainDataGrid.SelectedIndex];
            BindingList<Models.TaskStatus> taskStatus = taskView.TaskStatus;
            BindingList<Models.TaskStatus> taskStatusNew = new BindingList<Models.TaskStatus>();
            View.StatusTaskView statusTaskView = (View.StatusTaskView)window.DataContext;

            ObservableCollection<AnalizeTask.Models.TaskStatus> filtererdTests;
            if (task.StatusId != null)
            {
                filtererdTests = new ObservableCollection<Models.TaskStatus>(taskStatus.Where(t => t.Id == task.StatusId));
                if (statusTaskView.TaskStatus == null)
                    statusTaskView.TaskStatus = new BindingList<Models.TaskStatus>();
                statusTaskView.TaskStatus.Add(new Models.TaskStatus() { Name = filtererdTests[0].Name, Description = filtererdTests[0].Description, Id = filtererdTests[0].Id, ImageUrl = filtererdTests[0].ImageUrl, ImageUrl24 = filtererdTests[0].ImageUrl24 });
                window.initPicker();
                window.ShowDialog();

                if (System.IO.File.Exists(string.Format(@"{0}\{1}", Environment.CurrentDirectory, Properties.Settings.Default["FileStatusTaskColor"])))
                {
                    System.Xml.XmlDocument document = new System.Xml.XmlDocument();
                    document.Load(string.Format(@"{0}\{1}", Environment.CurrentDirectory, Properties.Settings.Default["FileStatusTaskColor"]));
                    System.Xml.XmlNodeList nodeList = document.SelectNodes("TasksStatuses/TaskStatus");

                    foreach (System.Xml.XmlNode node in nodeList)
                    {
                        System.Xml.XmlNode colorNode = node.SelectSingleNode("Color");
                        System.Xml.XmlNode idNode = node.SelectSingleNode("Id");

                        if (idNode.InnerText != task.StatusId)
                            continue;
                        //int i = 0;
                        int count = MainDataGrid.Items.Count;
                        for(int i = 0; i != MainDataGrid.Items.Count; i++)
                        {
                            Models.Task taskFind = (Models.Task)MainDataGrid.Items[i];
                            if(taskFind.StatusId != task.StatusId)
                                continue;
                            DataGridRow row = (DataGridRow)MainDataGrid.ItemContainerGenerator.ContainerFromIndex(i);
                            if (row != null)
                            {
                                MainDataGrid.UpdateLayout();
                                MainDataGrid.ScrollIntoView(MainDataGrid.Items[i]);
                                System.Drawing.Color color = System.Drawing.Color.FromArgb(Convert.ToInt32(colorNode.InnerText));
                                var colorBrush = new System.Windows.Media.SolidColorBrush(this.ColorToColor(color));
                                row.Background = colorBrush;
                            }

                        }
                        break;
                    }
                }
            }
        }