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

            source.Remove(plan);
            AutoSave();
            _lastSelectedPlan = null;
        }
Exemplo n.º 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();
        }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 10
0
 private void toBeClose(LayoutPlanModel plan)
 {
     RemovePlan(plan);
 }