/// <summary> /// 换肤打开调色板 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 1) { RemoteCarMeasureViewModel rcvm = this.DataContext as RemoteCarMeasureViewModel; Point cP = e.GetPosition(null); ChangeSkinColor changeSkin = new ChangeSkinColor(); changeSkin.Left = cP.X; changeSkin.ToolTip = cP.Y; changeSkin.SetValue(rcvm.BColor0); changeSkin.ShowDialog(); string rtClore = changeSkin.rtColor; //logH.SaveLog("点击换肤,返回颜色结果为:"+rtClore); #region 写日志 LogModel log = new LogModel() { CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Direction = LogConstParam.Directions_In, FunctionName = "坐席主窗体_换肤打开调色板", Level = LogConstParam.LogLevel_Info, Msg = "点击换肤,返回颜色结果为:" + rtClore, Origin = "汽车衡_" + LoginUser.Role.Name, OperateUserName = LoginUser.Name }; Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log)); #endregion DoRtColor(rtClore); } }
/// <summary> /// 坐席主窗体"是否可用"属性改变触发的事件 /// </summary> private void SeatMainForm_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) { if ((bool)e.NewValue == false) { RemoteCarMeasureViewModel rcvm = this.DataContext as RemoteCarMeasureViewModel; if (rcvm.FormEnableSource == 1) { //if (NewTaskGrid.Visibility == Visibility.Visible) //{ // //发送"退回任务"命令给任务服务器 // SocketCls.Emit(SeatSendCmdEnum.backTask, rcvm.SelectedTask.ClientId); //} LoginOutSystem(); } else if (rcvm.FormEnableSource == 2) { //if (NewTaskGrid.Visibility == Visibility.Visible) //{ // //发送"退回任务"命令给任务服务器 // SocketCls.Emit(SeatSendCmdEnum.backTask, rcvm.SelectedTask.ClientId); //} CloseSystem(); } } }
/// <summary> /// 汽车衡终端关注维护后坐席主页面的处理 /// </summary> /// <param name="wcau"></param> private void OperateCarMeasure(WeightClientAttentionUpholdView wcau) { RemoteCarMeasureViewModel rcmvm = this.DataContext as RemoteCarMeasureViewModel; var notCheckedAttionsIds = (from r in wcau.Attentions where r.IsChecked == false select r.equcode).ToList(); var checkedAttentions = (from r in wcau.Attentions where r.IsChecked == true select r).ToList(); var removeClients = (from r in rcmvm.CarWeighterClientInfos where notCheckedAttionsIds.Contains(r.ClientId) select r).ToList(); foreach (var item in removeClients) { rcmvm.CarWeighterClientInfos.Remove(item); //在已有的称点信息中删除未选中的称点 } foreach (var item in checkedAttentions) //将新添加的称点添加到集合里 { var list = (from r in rcmvm.CarWeighterClientInfos where r.ClientId == item.equcode select r).ToList(); if (list == null || list.Count == 0) { rcmvm.CarWeighterClientInfos.Add(new WeighterClientModel() { ClientId = item.equcode, LeftLightState = LeftLightStates.None, RightLightState = RightLightStates.None, ClientState = WeighterStates.None, ClientName = item.equname, Weight = 0, LeftLine = Visibility.Hidden, RightLine = Visibility.Hidden, ClientConfigName = item.equcode + "_" + item.equname + ".xml" }); } } rcmvm.CarWeighterClientInfos = rcmvm.CarWeighterClientInfos.OrderBy(r => Int32.Parse(r.ClientId.Substring(1))).ToList(); //任务服务器断开然后重新连接 SocketCls.Emit(ClientSendCmdEnum.logout, ""); //断开与任务服务器的连接 rcmvm.LoginOut(); //与任务服务器断开连接后的相关业务处理 rcmvm.relogin(); //重新登录时,会将称点关注改变后的称点ID集合发送给任务服务器。 ConfigSynchronous(checkedAttentions); }
/// <summary> /// 处理返回的颜色 /// </summary> /// <param name="rtColor"></param> private void DoRtColor(string rtColor) { if (!string.IsNullOrEmpty(rtColor)) { RemoteCarMeasureViewModel rcvm = this.DataContext as RemoteCarMeasureViewModel; rcvm.BColor0 = rtColor; rcvm.BColor1 = rtColor; string basePath = System.AppDomain.CurrentDomain.BaseDirectory; string url = basePath + @"/ClientConfig/UserUseColor.txt"; FileHelper.WriteText(url, rtColor); } }
/// <summary> /// 窗体加载后的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SeatMainForm_Loaded(object sender, RoutedEventArgs e) { ////程序版本 //txtVer.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString().Substring(0, 3); //同步时间 SynTime(); RemoteCarMeasureViewModel rcmvm = (RemoteCarMeasureViewModel)this.DataContext; rcmvm.InitForm(SeatAttentionInfos, this.SeatMainForm); //启动日志同步 //LogSync logSync = new LogSync(); //logSync.StartSyncLog(); }
public MainWindow(List <SeatAttentionWeightModel> seatAttentionInfos) { this.RegisterMessenger(); isAllowClose = false; RemoteCarMeasureViewModel rvm = this.DataContext as RemoteCarMeasureViewModel; InitializeComponent(); Rect rect = SystemParameters.WorkArea; this.MaxWidth = rect.Width + 14; this.MaxHeight = rect.Height + 14; this.WindowState = WindowState.Maximized; this.SeatNameTextBlock.Text = LoginUser.Name + "_" + LoginUser.Role.Name; this.SeatAttentionInfos = InfoExchange.Clone <List <SeatAttentionWeightModel> >(seatAttentionInfos); this.NewTaskGrid.Visibility = Visibility.Hidden; }
/// <summary> /// 主窗体激活时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SeatMainForm_Activated(object sender, EventArgs e) { RemoteCarMeasureViewModel rcvm = this.DataContext as RemoteCarMeasureViewModel; rcvm.CheckTaskHandleViewActive(); }