コード例 #1
0
ファイル: frmActivities.xaml.cs プロジェクト: ohadmanor/TDS
        public frmActivities(structTransportCommonProperty CommonProperty)
        {
            InitializeComponent();
            this.Background = new LinearGradientBrush(Colors.AliceBlue, Colors.LightGray, 90);
            AtomCommonProperty = CommonProperty;
            Title =AtomCommonProperty.AtomName+" "+ Title;

            SetGrid();
            LoadData();
        }
コード例 #2
0
ファイル: frmActivityEdit.xaml.cs プロジェクト: ohadmanor/TDS
        public frmActivityEdit(structTransportCommonProperty CommonProperty, GeneralActivityDTO ActivityDTO)
        {
            InitializeComponent();
            this.Background = new LinearGradientBrush(Colors.AliceBlue, Colors.LightGray, 90);
            txPlatformName.IsReadOnly = true;

            AtomCommonProperty = CommonProperty;
            refActivityDTO = ActivityDTO;

            if (AtomCommonProperty!=null)
            {
                txPlatformName.Text = AtomCommonProperty.AtomName;
            }
            
        }
コード例 #3
0
ファイル: clsSelectTools.cs プロジェクト: ohadmanor/TDS
        private void ShowGroundSelectAtomMenu(object sender,structTransportCommonProperty minDistAtom)
        {
            System.Windows.Application.Current.MainWindow.ContextMenu = null;

         //   System.Windows.Controls.ContextMenu contextmenu = new System.Windows.Controls.ContextMenu();
             contextmenu = new System.Windows.Controls.ContextMenu();


            System.Windows.Controls.MenuItem miName = new System.Windows.Controls.MenuItem();
            miName.Header = Properties.Resources.strNameColon + " " + minDistAtom.AtomName;///+ " " + minDistAtom.TextValue.Replace("_", "__"); ;
            miName.Focusable = false;
            contextmenu.Items.Add(miName);

            System.Windows.Controls.Separator Sp2 = new System.Windows.Controls.Separator();
            contextmenu.Items.Add(Sp2);


            System.Windows.Controls.MenuItem miGroundMission = new System.Windows.Controls.MenuItem();
            miGroundMission.Header = "Activity";// "Force Mission";
            miGroundMission.Name = "miGroundMission";
            miGroundMission.Tag = minDistAtom;
            miGroundMission.Click += new System.Windows.RoutedEventHandler(mnuGroundMission_Click);
            contextmenu.Items.Add(miGroundMission);



            System.Windows.Controls.MenuItem miMove = new System.Windows.Controls.MenuItem();
            miMove.Header = Properties.Resources.strMove; // "Move";
            miMove.Tag = minDistAtom;
            miMove.Name = "mnuMove";

            miMove.Click += miMove_Click;     // new System.Windows.RoutedEventHandler(mnuMove_Click);
            contextmenu.Items.Add(miMove);

            if(VMMainViewModel.Instance.CurrentGameStatus!= typGamestatus.EDIT_STATUS)
            {
                miMove.IsEnabled = false;
            }


            System.Windows.Controls.MenuItem miDeleteAtom = new System.Windows.Controls.MenuItem();
            miDeleteAtom.Header = Properties.Resources.strUndeploy;// Properties.Resources.strDelete;
            miDeleteAtom.Name = "miDeleteAtom";
            miDeleteAtom.Tag = minDistAtom;
            miDeleteAtom.Click += miDeleteAtom_Click;
            contextmenu.Items.Add(miDeleteAtom);

           // System.Windows.Application.Current.MainWindow.ContextMenu = new System.Windows.Controls.ContextMenu();
            System.Windows.Application.Current.MainWindow.ContextMenu = contextmenu;

            contextmenu.Visibility = Visibility.Visible;
            System.Windows.Application.Current.MainWindow.ContextMenu.Visibility = Visibility.Visible;
            System.Windows.Application.Current.MainWindow.ContextMenu.IsOpen = true;
          //  System.Windows.Application.Current.MainWindow.ContextMenu.Width = 1000;
        }
コード例 #4
0
ファイル: Utilites.cs プロジェクト: ohadmanor/TDS
        public static ImageSource ImageSourceAtom(structTransportCommonProperty refTarget)
        {

            string imageKey = "";

            ImageSource imageSource = null;

            System.Windows.Size sz = new System.Windows.Size(24, 24);
            System.Windows.Size szFor = new System.Windows.Size(15, 15);

            System.Windows.Size szP = new System.Windows.Size(20, 20);

            System.Windows.Point pnt = new System.Windows.Point(0, 0);
            System.Windows.Point pntP = new System.Windows.Point(5, 5);
            System.Windows.Point pntFor = new System.Windows.Point(2, 2);


            System.Windows.Rect rectBack = new System.Windows.Rect(pnt, sz);
            System.Windows.Rect rectP = new System.Windows.Rect(pntP, szP);

            System.Windows.Rect rectFor = new System.Windows.Rect(pntFor, szFor);

            ImageSource ImageSourceDrawHand = new BitmapImage(new Uri("pack://application:,,,/Images/PanDrag.ico"));


            

          //  if (refTarget.AtomClass == "GameService.clsGroundAtom" || refTarget.AtomClass == "GameService.clsTarget" || refTarget.AtomClass == "GameService.NavalTask.clsNavalAtom")
            {
                char ch = new char();
                System.Windows.Media.SolidColorBrush curBrush = new System.Windows.Media.SolidColorBrush();


               
                curBrush.Color = System.Windows.Media.Colors.Red;
               



               // ch = (char)refTarget.FontKey;
                ch = (char)150;
                //switch (refTarget.CountryColorSide)
                //{
                //    case COLOR_SIDE.BLUE:
                //        curBrush.Color = System.Windows.Media.Colors.Blue;
                //        break;
                //    case COLOR_SIDE.RED:
                //        curBrush.Color = System.Windows.Media.Colors.Red;
                //        break;
                //    case COLOR_SIDE.GREEN:
                //        curBrush.Color = System.Windows.Media.Colors.Green;
                //        break;
                //    case COLOR_SIDE.WHITE:
                //        curBrush.Color = System.Windows.Media.Colors.Gray;
                //        break;
                //}

                //System.Windows.Media.FormattedText frm = new System.Windows.Media.FormattedText(new string(ch, 1),
                //                                     System.Globalization.CultureInfo.GetCultureInfo("en-us"),
                //                                     System.Windows.FlowDirection.LeftToRight,
                //                                     new System.Windows.Media.Typeface("Simulation Font Environmental"),
                //                                     14, curBrush);

                System.Windows.Media.FormattedText frm = new System.Windows.Media.FormattedText(new string(ch, 1),
                                               System.Globalization.CultureInfo.GetCultureInfo("en-us"),
                                               System.Windows.FlowDirection.LeftToRight,
                                               new System.Windows.Media.Typeface("Wingdings 2"),
                                               42, curBrush);


                frm.TextAlignment = System.Windows.TextAlignment.Center;
                // frm.SetFontWeight(System.Windows.FontWeights.Bold);

                RenderTargetBitmap bmp = new RenderTargetBitmap(36, 36, 120, 96, PixelFormats.Pbgra32);

                DrawingVisual drawingVisual = new DrawingVisual();
                DrawingContext drawingContext = drawingVisual.RenderOpen();

                drawingContext.DrawText(frm, new System.Windows.Point(15, 5));
                drawingContext.DrawImage(ImageSourceDrawHand, rectP);

                drawingContext.Close();

                bmp.Render(drawingVisual);
                imageSource = bmp;


            }

            return imageSource;
        }
コード例 #5
0
ファイル: VMMainViewModel.cs プロジェクト: ohadmanor/TDS
        internal void DrawGroundAtomWPF(structTransportCommonProperty refGroundAtom, System.Windows.Media.DrawingContext dc)
        {
            int PixelX = 0;
            int PixelY = 0;
            char ch = new char();
            string ParentName = string.Empty;
            System.Windows.Media.SolidColorBrush BackgroundBrush = new SolidColorBrush();
            System.Windows.Media.SolidColorBrush curBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black);


            try
            {
                BackgroundBrush = Brushes.Red;
                curBrush.Color = System.Windows.Media.Colors.Red;
                if (refGroundAtom.isCollision)
                {
                    curBrush.Color = System.Windows.Media.Colors.Blue;
                }



                MyMainMap.ConvertCoordGroundToPixel(refGroundAtom.X, refGroundAtom.Y, ref PixelX, ref PixelY);

                ch = (char)150; //  1000;         //(char)refGroundAtom.FontKey;
				// Yinon Douchan: Added code for showing dead/injured
				int fontSize = 42;
                if (refGroundAtom.isDead)
                {
                    //curBrush.Color = System.Windows.Media.Colors.Black;
                    ch = (char)207;
                    fontSize = 16;
                }
                else if (refGroundAtom.isIncapacitated || refGroundAtom.isInjured)
                {
                    ch = (char)204;
                    fontSize = 16;
                }
				// ---------------------------------------------------
                //42

                //System.Windows.Media.FormattedText frm2 = new System.Windows.Media.FormattedText(new string(ch, 1),
                //                                    System.Globalization.CultureInfo.GetCultureInfo("en-us"),
                //                                    System.Windows.FlowDirection.LeftToRight,
                //                                    new System.Windows.Media.Typeface("Simulation Font Environmental"),
                //                                    24, curBrush);


				// Yinon Douchan: Added code for showing dead/injured
                System.Windows.Media.FormattedText frm2 = new System.Windows.Media.FormattedText(new string(ch, 1),
                                                  System.Globalization.CultureInfo.GetCultureInfo("en-us"),
                                                  System.Windows.FlowDirection.LeftToRight,
                                                  new System.Windows.Media.Typeface("Wingdings 2"),
                                                  fontSize, curBrush);
				// ---------------------------------------------------

                frm2.TextAlignment = System.Windows.TextAlignment.Center;

             // double w=  (frm2.Width / 8);
              double w = (frm2.Width / 2);
              w = 0;
              double h = frm2.Height / 2;
             //   dc.DrawText(frm2, new System.Windows.Point(PixelX, PixelY - frm2.Height / 2));
                dc.DrawText(frm2, new System.Windows.Point(PixelX + w, PixelY -h));




            }
            catch (Exception ex)
            {
            }


        }