Пример #1
0
 public void Import(string fileName,
     TechnicalServices.Persistence.SystemPersistence.Presentation.Presentation presentation,
     ResourceDescriptor[] resourceDescriptors, DeviceResourceDescriptor[] deviceResourceDescriptors,
     int indent, int height)
 {
     _indent = indent;
     _height = height;
     try
     {
         SlideBulk slideBulk = LoadFromFile(fileName, resourceDescriptors, deviceResourceDescriptors);
         if (slideBulk == null)
         {
             throw new InvalideFileException("Содержание файла некорректно. Импорт сцен невозмлжен");
         }
         CheckSlideNames(slideBulk);
         AddSlideAndLink(presentation, slideBulk);
         _importSlideController.SuccessMessage("Импорт сцен успешно завершен");
     }
     catch (InterruptOperationException)
     { }
     catch (InvalideFileException ex)
     {
         _importSlideController.ErrorMessage(ex.Message);
     }
     catch (Exception ex)
     {
         _importSlideController.ErrorMessage(string.Format("При экспорте сцен произошла неизвестная ошибка: {0}", ex));
     }
 }
Пример #2
0
        public void Export(string fileName, PresentationInfo presentationInfo,
            TechnicalServices.Persistence.SystemPersistence.Presentation.Slide[] slideToExport)
        {
            try
            {
                if (slideToExport == null || slideToExport.Length == 0) return;
                _continue = _exportSlideController.GetUserInterActive(slideToExport.Length == 1);

                // загружаем сцены
                TechnicalServices.Persistence.SystemPersistence.Presentation.Slide[] slideArr =
                    LoadSlides(presentationInfo, slideToExport);

                // формируем балк для выгрузки
                SlideBulk slideBulk = ComposeSlideBulk(presentationInfo, slideArr);
                // сохраняем на диск
                SaveToDisk(fileName, slideBulk);
                //_exportSlideController.SuccessMessage("Экспорт сцен успешно завершен");
            }
            catch (InterruptOperationException)
            {
                if (slideToExport.Length > 1)
                    _exportSlideController.ErrorMessage(string.Format("Экспорт сцен был прерван пользователем"));
            }
            catch (Exception ex)
            {
                _exportSlideController.ErrorMessage(string.Format("При экспорте сцен произошла неизвестная ошибка: {0}", ex));
            }
        }
Пример #3
0
 public override System.Windows.Forms.Control CreateControlForSource(IEventLogging logging, TechnicalServices.Persistence.SystemPersistence.Presentation.Source source, System.Windows.Forms.Control parent, IPlayerCommand playerCommand, IPresentationClient client)
 {
     PlayerController controller = new PlayerController(source, playerCommand);
     VNCPlayerControl control = new VNCPlayerControl(controller);
     control.Parent = parent;
     parent.Controls.Add(control);
     control.CreateControl();
     return control;
 }
Пример #4
0
        //Set the map modification object type
        internal void setMapModObjectType()
        {
            if (mapModName.Equals("rectangle"))
            {
                mapModObject = new System.Windows.Shapes.Rectangle();
                mapModObject.StrokeThickness = 3;
            }

            if (mapModName.Equals("circle"))
            {
                mapModObject = new System.Windows.Shapes.Ellipse();
                mapModObject.StrokeThickness = 3;
            }

            if (mapModName.Equals("ramp") || mapModName.Equals("camp") || mapModName.Equals("stairs"))
            {
                mapModObject = new System.Windows.Shapes.Rectangle();
                ImageBrush mapModImg = new ImageBrush();
                MapMods    mapModi   = (MapMods)Enum.Parse(typeof(MapMods), mapModName);
                mapModImg.ImageSource = TechnicalServices.getImage(mapModi);
                mapModObject.Fill     = mapModImg;
            }

            if (mapModName.Equals("text"))
            {
                textInput = MainWindow.getAdditionalTextInput();

                if (textInput == null || textInput.Equals(""))
                {
                    textInput = "Enter text";
                }
                else
                {
                    textInput = MainWindow.getAdditionalTextInput();
                }

                System.Drawing.Font   font   = new System.Drawing.Font("Times New Roman", 35.0f);
                System.Drawing.Bitmap bitmap = DrawText(textInput, font, System.Drawing.Color.Black, System.Drawing.Color.Transparent);

                ToBitmapImage(bitmap);
                BitmapImage bitmapimg = ToBitmapImage(bitmap);
                mapModObject = new System.Windows.Shapes.Rectangle();
                ImageBrush mapModImg = new ImageBrush();
                mapModImg.ImageSource = bitmapimg;
                mapModObject.Fill     = mapModImg;
            }

            if (mapModName.Equals("line"))
            {
                return;
            }
        }
Пример #5
0
        public bool Init(DisplayType display, TechnicalServices.Persistence.SystemPersistence.Presentation.Window window)
        {
            this.InitBorderTitle(window, panel1);
            ActiveWindow activeWindow = window as ActiveWindow;
            if (activeWindow != null)
            {
                _croppingBottom = activeWindow.CroppingBottom;
                _croppingLeft = activeWindow.CroppingLeft;
                _croppingRight = activeWindow.CroppingRight;
                _croppingTop = activeWindow.CroppingTop;
            }

            return true;
        }
Пример #6
0
        //Filling up the page with the information on the team
        private void PopulateInfo()
        {
            equipmentStackPanel.Children.RemoveRange(1, equipmentStackPanel.Children.Count - 1);

            teamName.Name = team.getName();
            if (team.getName().Length == 1)
            {
                teamName.Text = TechnicalServices.getPhoneticLetter(team.getName());
            }
            else
            {
                teamName.Text = team.getName();
            }

            ImageBrush img = new ImageBrush();

            img.ImageSource   = TechnicalServices.getImage(team.getHighestLevelOfTraining());
            teamTraining.Fill = img;

            List <Equipment> equipmentList = team.getEquipmentList();

            foreach (Equipment eq in equipmentList)
            {
                EquipmentIcon equip = new EquipmentIcon(team, this, 27, eq);
                equip.setImage(TechnicalServices.getImage(eq.getEquipmentType()));
                equipmentStackPanel.Children.Add(equip);
            }

            TeamMember member   = null;
            int        position = 0;

            while ((member = team.getMember(position++)) != null)
            {
                Grid memberLine = (Grid)informations.Children[position];
                memberLine.Visibility = System.Windows.Visibility.Visible;
                member.setNameGrid(memberLine);

                Label memberName = (Label)memberLine.Children[0];
                memberName.Content = member.getName();
                memberName.ToolTip = DepartureTimeToString(member);

                Rectangle  memberTraining = (Rectangle)memberLine.Children[1];
                ImageBrush img2           = new ImageBrush();
                img2.ImageSource    = TechnicalServices.getImage(member.getTrainingLevel());
                memberTraining.Fill = img2;
            }
        }
Пример #7
0
        public InterventionPin(Intervention intervention, MapSectionPage mapSection) : base(intervention, mapSection, size)
        {
            this.intervention = intervention;             //Providing a link to the team that this pin represents

            //Setting the image and text of the pin
            base.setImage(TechnicalServices.getImage("intervention"));
            base.setText(intervention.getInterventionNumber().ToString());

            //Setting the intervention pin  of all team pins that are intervening on this pin
            foreach (TeamPin teamPin in getInterveningTeamsPin())
            {
                teamPin.setInterventionPin(this);
            }

            //Register as an observer to the intervention instance so that any modification to it are reflected on the map, e.g. addition of a team
            intervention.RegisterInstanceObserver(this);
        }
Пример #8
0
        public EquipmentPin(Equipment equipment, MapSectionPage mapSection) : base(equipment, mapSection, size)
        {
            this.equipment = equipment;                                              //Providing a link to the equipment that this pin represents

            base.setImage(TechnicalServices.getImage(equipment.getEquipmentType())); //Setting background image

            //Adding contect menu so that the user can delete the equipment
            MenuItem menuItem = new MenuItem();

            menuItem.Uid    = "MenuItem_EquipmentPin_Delete";
            menuItem.Header = ETD.Properties.Resources.MenuItem_EquipmentPin_Delete;
            menuItem.Click += DeleteEquipment_Click;

            ContextMenu contextMenu = new ContextMenu();

            contextMenu.Items.Add(menuItem);

            this.ContextMenu = contextMenu;
        }
Пример #9
0
        //Callback when the team instance has changed
        public void Update()
        {
            //Redraw the background image and text
            base.Children.Clear();
            base.setImage(TechnicalServices.getImage(team, team.getStatus()));
            base.setText(team.getName());             //Although the text doesn't change, we have to redraw it for it not to be hidden by the image

            //Making the appropriate movement with the information provided by GPS
            if (this != draggedPin && team.getStatus() != Statuses.intervening && gpsLocation != null && GPSLocation.gpsConfigured == true && GPSServices.connectedToServer && gpsLocation.PhoneOnline())
            {
                setPinPosition(gpsLocation.getX(), gpsLocation.getY());                 //Move the team
                CollisionDetectionAndResolution(true);

                //Updating arrow if any for it to point from the current teams position to its destination
                if (destinationArrowDictionnary.ContainsKey(team) && destinationArrowDictionnary[team] != null)
                {
                    destinationArrowDictionnary[team].ChangeStart(getX(), getY());
                }
            }
        }
Пример #10
0
 public MapModPin(MapMod mapMod, AdditionalInfoPage aiSection, double width, double height)
     : base(mapMod, aiSection, aiSection.ActualWidth, aiSection.ActualHeight)
 {
     base.setImage(TechnicalServices.getImage(mapMod.getMapModType())); //Setting the image of the map modification pin
     mapModification = mapMod;                                          //Providing a link to the map that this pin represents
 }
Пример #11
0
 public void Logoff(TechnicalServices.Entity.UserIdentity user)
 {
     _loginStorage.Logoff(user);
 }
Пример #12
0
 private void AddSlideAndLink(TechnicalServices.Persistence.SystemPersistence.Presentation.Presentation presentation,
     SlideBulk slideBulk)
 {
     //SetInitialPosition(presentation.SlidePositionList.Values, slideBulk.SlidePositionList.Values);
     // слайды
     // айдишники меняются, так что запоминаем те которые были
     Dictionary<int, int> oldNewIdMapping = new Dictionary<int, int>(slideBulk.SlideList.Count);
     foreach (TechnicalServices.Persistence.SystemPersistence.Presentation.Slide slide in slideBulk.SlideList)
     {
         int oldId = slide.Id;
         if (slide.LabelId != Label.NullId
             && presentation.SlideList.Select(sl=>sl.LabelId).Where(lb=>lb != Label.NullId).Any(
             lb=>lb == slide.LabelId))
         {
             slide.LabelId = Label.NullId;
         }
         _importSlideController.AddSlide(slide);
             //, GetPoint(slideBulk.SlidePositionList[slide.Id]));
         oldNewIdMapping[slide.Id] = oldId;
     }
     // линки
     foreach (TechnicalServices.Persistence.SystemPersistence.Presentation.Slide slide in slideBulk.SlideList)
     {
         SlideLinkList slideLinkList;
         if (!slideBulk.LinkDictionary.TryGetValue(oldNewIdMapping[slide.Id], out slideLinkList)) continue;
         foreach (Link link in slideLinkList.LinkList.OrderByDescending(ln=>ln.IsDefault))
         {
             _importSlideController.AddLink(slide, link.NextSlide);
         }
     }
 }
Пример #13
0
 void presentationNotifier_OnDeviceResourceAdded(object sender, TechnicalServices.Common.Classes.NotifierEventArg<DeviceResourceDescriptor> e)
 {
     AddResource(e.Data);
 }
Пример #14
0
        public bool Init(DisplayType display, TechnicalServices.Persistence.SystemPersistence.Presentation.Window window)
        {
            this.InitBorderTitle(window, panel1);

            return true;
        }
Пример #15
0
 //window closed
 public void WindowClosed(object sender, System.EventArgs e)
 {
     TechnicalServices.saveMap(mapModificationSection);
 }
Пример #16
0
 /// <summary>
 /// Обрабочик включения/выключения галочки в списке дисплеев
 /// </summary>
 /// <param name="disp">Измененный дисплей</param>
 /// <param name="isChecked">Новое значение галочки</param>
 /// <returns>true, если данный дисплей можно включить</returns>
 bool Instance_OnDisplayChecked(TechnicalServices.Persistence.SystemPersistence.Presentation.Display disp, bool isChecked)
 {
     if (isChecked)
     {
         DisplayViewer viewer = new DisplayViewer(disp) { Pos = getPosition(disp) };
         m_Viewers.Add(disp.Type.Name, viewer);
         if (OnViewerAdded != null)
             OnViewerAdded(viewer);
     }
     else if (OnViewerRemoved != null)
     {
         m_Viewers.Remove(disp.Type.Name);
         OnViewerRemoved(new DisplayViewer(disp) { Pos = defaultPos });
     }
     PresentationController.Instance.NotifyMonitorListChanged(from pair in m_Viewers select pair.Value.Display);
     return true;
 }
 static void importPresentation_OnPresentationAdded(TechnicalServices.Persistence.SystemPersistence.Presentation.PresentationInfo presentationInfo)
 {
     DesignerClient.Instance.PresentationNotifier.PresentationAdded(
         Thread.CurrentPrincipal as UserIdentity,
         new PresentationInfoExt(presentationInfo, null));
 }
Пример #18
0
 void Instance_OnSlideLockChanged(Slide slide, bool IsLocked, TechnicalServices.Entity.LockingInfo info)
 {
     if (PresentationController.Instance.SelectedSlide.Id == slide.Id)
     {
         this.Invoke(new MethodInvoker(() =>
         {
             propertyGrid.IsEnabled = IsLocked && PresentationController.Instance.CanUnlockSlide(slide) && (equipmentList.SelectedNode != null && equipmentList.SelectedNode.Checked);
         }));
     }
 }