Esempio n. 1
0
 /// <summary>
 /// AGV标示图片初始化
 /// </summary>
 public void AnimatedImageInit()
 {
     animatedImage        = new Image();
     animatedImage.Source = AGVUtils.GetImageFromFile(@"Image\navigation_24.png");//new BitmapImage( new Uri(@"Image\navigation_24.png", UriKind.RelativeOrAbsolute));
     animatedImage.Width  = animatedImage.Source.Width * NavZoomMultis;
     animatedImage.Height = animatedImage.Source.Height * NavZoomMultis;
     CarCanvas.Children.Add(animatedImage);
 }
Esempio n. 2
0
 /// <summary>
 /// 窗口关闭
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Window_Closed(object sender, EventArgs e)
 {
     if (IsModify)
     {
         if (MessageBox.Show("修改成功!重启软件生效。是否立即重启软件?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
         {
             AGVUtils.RestartSystem();
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 界面切换时间间隔文本框输入触发事件
 /// 以与设备无关的方式侦听文本输入,如果输入的是英文字符,那么执行e.Handled = true之后,TextBox中确实没有字符出现。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tbpageinterval_PreviewTextInput(object sender, TextCompositionEventArgs e)
 {
     if (!AGVUtils.IsNumberic(e.Text))
     {
         e.Handled = true;
     }
     else
     {
         e.Handled = false;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 加载电子地图背景图片
        /// </summary>
        public void MapInit()
        {
            ImageBrush imageBrush = new ImageBrush();

            imageBrush.ImageSource = GlobalPara.mapImage;
            imageBrush.Stretch     = Stretch.Uniform;
            imageBrush.AlignmentX  = AlignmentX.Left;
            imageBrush.AlignmentY  = AlignmentY.Top;
            canvas.Background      = imageBrush;
            canvas.Height          = GlobalPara.MapHeight;
            canvas.Width           = GlobalPara.MapWidth;
            background.Source      = AGVUtils.GetImageFromFile(@"Image\mapbackground.png");
            Canvas.SetLeft(marquee, canvas.ActualWidth / 2 - marquee.ActualWidth / 2);
        }
Esempio n. 5
0
 /// <summary>
 /// 界面切换时间间隔文本框粘帖触发事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tbpageinterval_Pasting(object sender, DataObjectPastingEventArgs e)
 {
     if (e.DataObject.GetDataPresent(typeof(String)))
     {
         String text = (String)e.DataObject.GetData(typeof(String));
         if (!AGVUtils.IsNumberic(text))
         {
             e.CancelCommand();
         }
     }
     else
     {
         e.CancelCommand();
     }
 }
Esempio n. 6
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (string.IsNullOrEmpty(tbAGVnum.Text.Trim()))
            {
                MessageBox.Show("输入不能为空!");
                tbAGVnum.Focus();
                e.Cancel = true;
                return;
            }
            Regex regex = new Regex(@"^[0-9]*[1-9][0-9]*$");//匹配正整数

            if (!regex.IsMatch(tbAGVnum.Text.Trim()))
            {
                MessageBox.Show("请输入正整数字!");
                tbAGVnum.Focus();
                e.Cancel = true;
                return;
            }
            try
            {
                Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                cfa.AppSettings.Settings["AGVNUM_MAX"].Value = tbAGVnum.Text.Trim();
                cfa.AppSettings.Settings["MapScale"].Value   = tbMapScale.Text.Trim();
                cfa.AppSettings.Settings["TRAFFICFUN"].Value = cbTrafficFun.IsChecked.ToString();
                cfa.AppSettings.Settings["DOCKFUN"].Value    = cbDockFun.IsChecked.ToString();
                cfa.AppSettings.Settings["CHARGEFUN"].Value  = cbChargeFun.IsChecked.ToString();
                cfa.AppSettings.Settings["CALLFUN"].Value    = cbCallFun.IsChecked.ToString();
                cfa.AppSettings.Settings["CLIENTFUN"].Value  = cbClientFun.IsChecked.ToString();
                cfa.Save(ConfigurationSaveMode.Modified);
                if (!GetParamString().Equals(InitParamString))
                {
                    if (MessageBox.Show("修改成功!重启软件生效。是否立即重启软件?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        AGVUtils.RestartSystem();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("修改失败!原因:" + ex.Message);
                e.Cancel = true;
            }
        }
Esempio n. 7
0
 /// <summary>
 /// 修改配置参数
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnModify_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(tbAGVnum.Text.Trim()))// || string.IsNullOrEmpty(tbWaiting.Text.Trim()))
         {
             MessageBox.Show("输入不能为空!");
             return;
         }
         Regex regex = new Regex(@"^[0-9]*[1-9][0-9]*$"); //匹配正整数
         if (regex.IsMatch(tbAGVnum.Text.Trim()))         // && regex.IsMatch(tbWaiting.Text.Trim()))
         {
             Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
             cfa.AppSettings.Settings["AGVNUM_MAX"].Value = tbAGVnum.Text.Trim();
             cfa.AppSettings.Settings["MapScale"].Value   = tbMapScale.Text.Trim();
             cfa.AppSettings.Settings["TRAFFICFUN"].Value = cbTrafficFun.IsChecked.ToString();
             cfa.AppSettings.Settings["DOCKFUN"].Value    = cbDockFun.IsChecked.ToString();
             cfa.AppSettings.Settings["CHARGEFUN"].Value  = cbChargeFun.IsChecked.ToString();
             cfa.AppSettings.Settings["CALLFUN"].Value    = cbCallFun.IsChecked.ToString();
             cfa.AppSettings.Settings["CLIENTFUN"].Value  = cbClientFun.IsChecked.ToString();
             //cfa.AppSettings.Settings["TRAFFIC_CONAREA_MAX"].Value = tbTraffic.Text.Trim();
             //cfa.AppSettings.Settings["TRAFFIC_CONAREA_MARKNUM_MAX"].Value = tbMark.Text.Trim();
             //cfa.AppSettings.Settings["TRAFFIC_CONAREA_WAITAGVNUM_MAX"].Value = tbWaiting.Text.Trim();
             cfa.Save(ConfigurationSaveMode.Modified);
             if (MessageBox.Show("修改成功!重启软件生效。是否立即重启软件?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
             {
                 AGVUtils.RestartSystem();
             }
         }
         else
         {
             MessageBox.Show("请输入正整数字!");
         }
     }
     catch
     {
         MessageBox.Show("修改失败!");
     }
 }