Example #1
0
 private TimeSwitchInfo getLayoutPlanModel(LayoutPlanModel model)
 {
     return(new TimeSwitchInfo()
     {
         Plan = model.LayoutSource.SplitScreenData,
         StayTime = model.StaySeconds
     });
 }
 private void toDelete(LayoutPlanModel obj)
 {
     if (ViewModel != null)
     {
         ViewModel.ToBeDelete -= toDelete;
     }
     layoutPlan.DataContext = null;
 }
Example #3
0
 public void ToDragPlan()
 {
     if (SelectedPlan != null)
     {
         var source = getSource();
         DragPlan     = SelectedPlan;
         SelectedPlan = null;
         source.Remove(DragPlan);
     }
 }
Example #4
0
        public void RemovePlan(LayoutPlanModel plan)
        {
            plan.ToBeDelete  -= toBeClose;
            plan.DataChanged -= LayoutPlan_DataChanged;
            clearSelectedAndUpdateCurrentPlan();
            var source = getSource();

            source.Remove(plan);
            AutoSave();
            _lastSelectedPlan = null;
        }
Example #5
0
        void addNewPlan(LayoutPlanModel newPlan)
        {
            newPlan.ToBeDelete  += toBeClose;
            newPlan.DataChanged += LayoutPlan_DataChanged;
            var source = getSource();

            source.Insert(source.Count - 1, newPlan);
            SelectedPlan = newPlan;
            updateCurrentPlan();
            AutoSave();
        }
Example #6
0
 public void ToDropPlan(int index)
 {
     if (DragPlan != null && index >= 0)
     {
         var source = getSource();
         index = Math.Min(index, source.Count - 1);
         source.Insert(index, DragPlan);
         SelectedPlan = DragPlan;
         updateCurrentPlan();
         DragPlan = null;
     }
 }
Example #7
0
 void updateCurrentPlan()
 {
     if (SelectedPlan != null && SelectedPlan.LayoutSource != null)
     {
         if (CurrentPlan.SplitScreenModel != SelectedPlan.LayoutSource)
         {
             CurrentPlan.SplitScreenModel = SelectedPlan.LayoutSource;
             CurrentPlan.SplitLayoutsModel.SplitScreenSource.View.Refresh();
         }
     }
     else
     {
         CurrentPlan.SplitScreenModel = new SplitScreenModel();
     }
     _lastSelectedPlan = SelectedPlan;
 }
Example #8
0
        private void clearLayout()
        {//TODO:清空界面布局方案
            clearSelectedAndUpdateCurrentPlan();
            var source = getSource();

            source.ToList().ForEach(e =>
            {
                if (e != AddPlanStatic)
                {
                    e.ToDelete();
                    e.DataChanged -= LayoutPlan_DataChanged;
                }
            });
            while (source.Count() > 1)
            {
                source.RemoveAt(0);
            }
            _lastSelectedPlan = null;
            AutoSave();
        }
Example #9
0
        LayoutPlanModel getDefaultPlanLayout()
        {
            LayoutPlanModel model = new LayoutPlanModel();
            LayoutPlanModel plan  = null;

            if (_lastSelectedPlan != null && _lastSelectedPlan != AddPlanStatic)
            {
                plan = _lastSelectedPlan;
            }
            if (plan == null)
            {
                var source = getValidSource();
                plan = source.Count == 0 ? null : source.Last();
            }
            if (plan != null)
            {
                var splitData = plan.LayoutSource.SplitScreenData.Clone();
                splitData.Nodes.ToList().ForEach(e => e.VideoId = string.Empty);
                model.LayoutSource.SplitScreenData = splitData;
                model.StaySeconds = plan.StaySeconds;
            }
            return(model);
        }
Example #10
0
 private void toBeClose(LayoutPlanModel plan)
 {
     RemovePlan(plan);
 }