private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;
            LBModel  model    = checkBox.DataContext as LBModel;

            WriteXmlHelper.saveModel(model);
        }
        //查询灯箱状态
        private void btnSearchState_Click(object sender, RoutedEventArgs e)
        {
            LBModel model = null;

            if (LightBoxHelper.listModel.Count > 0)
            {
                model = LightBoxHelper.listModel[0];
            }
            else
            {
                model = LightBoxHelper.SelectedModel;
            }
            foreach (LBMsg msg in model.ListLBMsg)
            {
                byte[] byDate = new byte[3];
                byDate[0] = 4;
                byDate[1] = (byte)msg.Id;
                byDate[2] = (byte)(msg.Id >> 8);
                CanDataWithInfo can = new CanDataWithInfo(0x01, byDate, "查状态");
                ECANHelper.ins.sendMessageWithInfo(can);
            }

            //全网一条指令查询,可能造成同时回复数据过多,导致模块内缓存溢出
            //byte[] byDate = new byte[3];
            //byDate[0] = 6;
            //CanDataWithInfo can = new CanDataWithInfo(0x01, byDate, "");
            //ECANHelper.ins.sendMessageWithInfo(can);
        }
        private void LightBoxHelper_modelChanged(object sender, EventArgs e)
        {
            LBModel model = sender as LBModel;

            listBoxModels.Dispatcher.Invoke(new Action(() => { listBoxModels.SelectedItem = model; }));
            labelModelName.Dispatcher.Invoke(new Action(() => { labelModelName.Content = model.ModelName; }));
        }
Exemplo n.º 4
0
 private void refreshModelId(int id, LBModel model)
 {
     foreach (LBMsg msg in model.ListLBMsg)
     {
         msg.Id = msg.Id - minId + id;
     }
 }
Exemplo n.º 5
0
        public WidEditLBMsg(LBModel lBModel)
        {
            InitializeComponent();
            this.lBModel = lBModel;
            txtName.Text = lBModel.ModelName;

            comboBoxMinute.SelectedIndex  = (int)lBModel.MWaitTime.WaitMM;
            comboBoxSeconds.SelectedIndex = (int)lBModel.MWaitTime.WaitSS;
            cbRunAll.IsChecked            = lBModel.runAll;
        }
Exemplo n.º 6
0
 public static void updateModel(LBModel lbmodel)
 {
     foreach (LBModel model in listModel)
     {
         if (model.ModelName.Equals(lbmodel.ModelName))
         {
             model.MWaitTime.WaitMM = lbmodel.MWaitTime.WaitMM;
             model.MWaitTime.WaitSS = lbmodel.MWaitTime.WaitSS;
             model.runAll           = lbmodel.runAll;
             break;
         }
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// 删除模式
 /// </summary>
 /// <param name="modelName"></param>
 public static void delModel(string modelName)
 {
     foreach (LBModel model in listModel)
     {
         if (model.ModelName.Equals(modelName))
         {
             listModel.Remove(model);
             FileInfo file = new FileInfo(WriteXmlHelper.FILE_MODEL + modelName + ".xml");
             file.Delete();
             modelIndex    = -1;
             SelectedModel = null;
             break;
         }
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 获取所有模式
        /// </summary>
        /// <returns></returns>
        public static List <LBModel> FindModels(List <string> listModelNames)
        {
            List <LBModel> listLBModels = new List <LBModel>();

            foreach (string name in listModelNames)
            {
                LBModel lbModel = ReadXmlHelper.getListBoxMsgs(WriteXmlHelper.FILE_MODEL + name + ".xml");
                lbModel.ModelName = name;
                listLBModels.Add(lbModel);
                //if (lbModel.Active) {
                //    listLBModels.Add(lbModel);
                //}
            }
            return(listLBModels);
        }
Exemplo n.º 9
0
 public static void setModelSelected(LBModel model)
 {
     foreach (LBModel m in listModel)
     {
         if (m == model)
         {
             m.Selected = true;
         }
         else
         {
             m.Selected = false;
         }
     }
     changeModel(model);
     modelIndex = listModel.IndexOf(model);
 }
Exemplo n.º 10
0
        public static LBModel createInitModel()
        {
            LBModel model = new LBModel();

            for (int i = 1; i <= BaseConfig.ins.Rows; i++)
            {
                for (int j = 1; j <= BaseConfig.ins.Columns; j++)
                {
                    LBMsg lBMsg = new LBMsg();
                    lBMsg.Id     = getLightBoxId(i, j);
                    lBMsg.Row1   = i;
                    lBMsg.Column = j;
                    model.ListLBMsg.Add(lBMsg);
                }
            }
            return(model);
        }
Exemplo n.º 11
0
 /// <summary>
 /// 从文件中读取所有模式
 /// </summary>
 public static void initModels()
 {
     listModel = FindModels(FindModelNames());
     listModel.Sort();
     for (int i = 0; i < listModel.Count; i++)
     {
         LBModel model = listModel[i];
         if (model.sortIndex != i)
         {
             model.sortIndex = i;
             WriteXmlHelper.saveModel(model);
         }
     }
     if (listModel.Count > 0)
     {
         setModelSelected(listModel[0]);
     }
 }
Exemplo n.º 12
0
 private static void changeModel(LBModel nextModel)
 {
     SelectedModel.ModelName = nextModel.ModelName;
     SelectedModel.MWaitTime = nextModel.MWaitTime;
     SelectedModel.runAll    = nextModel.runAll;
     foreach (LBMsg lb in nextModel.ListLBMsg)
     {
         LBMsg lBMsg = SelectedModel.getLightBoxMsg(lb.Row1, lb.Column);
         if (null != lBMsg)
         {
             lBMsg.Id          = lb.Id;
             lBMsg.WaitTime    = lb.WaitTime;
             lBMsg.RunTime     = lb.RunTime;
             lBMsg.KeepTime    = lb.KeepTime;
             lBMsg.RepeatCount = lb.RepeatCount;
         }
     }
     nextModel.getListWaitTime();
     modelChanged?.Invoke(nextModel, null);
 }
Exemplo n.º 13
0
        private static void prevModel(object obj)
        {
            modelIndex--;
            if (modelIndex <= 0)
            {
                modelIndex = listModel.Count - 1;
            }
            LBModel nextModel = prevActiveModel();

            if (null == nextModel)
            {
                return;
            }
            if (!nextModel.ModelName.Equals(SelectedModel))
            {
                setModelSelected(nextModel);
            }
            //初始化等待时间
            //nextModel.getListWaitTime();
            modelChanging = false;
        }
Exemplo n.º 14
0
        private static LBModel prevActiveModel()
        {
            LBModel model = null;

            //先从modelIndex位置往前找
            for (int i = modelIndex; i >= 0; i--)
            {
                LBModel m = listModel[i];
                if (m.Active)
                {
                    modelIndex = i;
                    model      = m;
                    break;
                }
            }

            if (null == model)
            {
                videoBegin = false;
                //选择第一个模式
                //modelIndex = 1;
            }

            //如果没找到再从0的位置找到modelIndex位置
            if (null == model)
            {
                for (int i = listModel.Count - 1; i >= modelIndex; i--)
                {
                    LBModel m = listModel[i];
                    if (m.Active)
                    {
                        modelIndex = i;
                        model      = m;
                        break;
                    }
                }
            }
            return(model);
        }
Exemplo n.º 15
0
        private static void nextModel(object obj)
        {
            if (modelIndex == -1)
            {
                modelIndex = 0;
            }
            else
            {
                modelIndex++;
            }
            LBModel nextModel = nextActiveModel();

            if (null == nextModel)
            {
                return;
            }
            if (!nextModel.ModelName.Equals(SelectedModel))
            {
                setModelSelected(nextModel);
            }
            //初始化等待时间
            //nextModel.getListWaitTime();
            modelChanging = false;
        }
Exemplo n.º 16
0
 public static void InsertNewBank(LooneyBank.Core.Bank bank, LBModel.LBEntities currentContext)
 {
     currentContext.spLOONEYBANK_Bank_Insert(bank.bankName, bank.bankDescription, bank.isOpen, bank.routingNumber);
 }
Exemplo n.º 17
0
 public static void SaveBank(LooneyBank.Core.Bank bank, LBModel.LBEntities currentContext)
 {
     //add code to update bank object's information in the currentContext.
 }
 public WidAllKeepTime(LBModel lBModel)
 {
     InitializeComponent();
     this.lBModel = lBModel;
 }