public static void SetStatusPicture(ModelGroupItem model)
 {
     switch (model.Status)
     {
         case ModelGroupItem.MessageStatus.Error:
             model.viewGroupItem.StatusCheck.Visibility = Visibility.Hidden;
             model.viewGroupItem.StatusCheck.IsChecked = false;
             model.viewGroupItem.StatusImage.Visibility = Visibility.Visible;
             model.viewGroupItem.StatusImage.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Tiles/Sync.png"));
             break;
         case ModelGroupItem.MessageStatus.MessageSent:
             model.viewGroupItem.StatusCheck.Visibility = Visibility.Hidden;
             model.viewGroupItem.StatusImage.Visibility = Visibility.Visible;
             model.viewGroupItem.StatusImage.Source = new BitmapImage(new Uri(@"pack://*****:*****@"pack://siteoforigin:,,,/Tiles/Exclamation.png"));
             model.viewGroupItem.StatusImage.ToolTip = "Не все поля заполнены";
             break;
         case ModelGroupItem.MessageStatus.Ready:
             model.viewGroupItem.StatusImage.Visibility = Visibility.Hidden;
             model.viewGroupItem.StatusCheck.Visibility = Visibility.Visible;
             break;
     } 
 }
 /// <summary>
 /// Устанавливает в вид Settings значения свойств из модели GroupItem
 /// </summary>
 /// <param name="Model"> Модель GroupItem </param>
 /// <param name="View"> Вид Settings</param>
 public static void SaveModel(ModelGroupItem model, ViewSettings view, ViewGroupItem viewGroupItem)
 {
     model.title = view.Title1.Text;
     model.message = view.Message.Text;
     model.hashTags = view.HashTags.Text;
     model.albumId = view.AlbumId.Text;
     model.groupId = view.GroupId.Text;
     model.path = view.Path.Text;
     model.color = view.Color.SelectedColor;
     model.SetStatus();
 }
        public static void ChangeGroupItem(ModelGroupItem model)
        {
            model.viewGroupItem.Title.Text = model.title;

            SetStatusPicture(model);

            if (model.color != null)
            {
                SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(model.color.Value.A, model.color.Value.R, model.color.Value.G, model.color.Value.B));
                model.viewGroupItem.GroupRect.Fill = brush;
            }
        }
 /// <summary>
 /// Устанавливает в вид значения свойств из модели
 /// </summary>
 /// <param name="Model"> Модель </param>
 /// <param name="View"> Вид </param>
 public static void SetSettingsView(ViewSettings view, ModelGroupItem model)
 {          
     // Связываем содержание объекта с отображением в настройках
     view.modelGroupItem = model;
     view.Message.Text = model.message;
     view.HashTags.Text = model.hashTags;
     view.AlbumId.Text = model.albumId;
     view.GroupId.Text = model.groupId;
     view.Path.Text = model.path;
     view.Title1.Text = model.title;
     view.Color.SelectedColor = model.color;
 }
예제 #5
0
        private void Click_AddGroup(object sender, MouseButtonEventArgs e)
        {
            ModelGroupItem modelGroupItem = new ModelGroupItem(itemId, viewSettings, listBox, listGroupItem);
            ViewGroupItem viewGroupItem = new ViewGroupItem(modelGroupItem, viewSettings);
            modelGroupItem.viewGroupItem = viewGroupItem;
            ControllerGroupItem.SetStatusPicture(modelGroupItem);
            

            //modelGroupItem.Status = ModelGroupItem.MessageStatus.NotReady;

            listGroupItem.Add(modelGroupItem);
            listBox.Items.Insert(listBox.Items.Count-1, viewGroupItem);

            // Увеличим item_id для последующих элементов
            itemId++;
        }
 public ViewGroupItem(ModelGroupItem model, ViewSettings settings)
 {
     this.model = model;
     InitializeComponent();
 }