Ejemplo n.º 1
0
        private void OnSelectedPixelChanged(object sender, PixelChangedEventArgs e)
        {
            FrameNumber   = _selectionService.SelectedFrame.Number;
            PixelLocation = e.SelectedPixel;

            HasSelectedPixel = true;
            _pixelEvents.Clear();

            var swapChainPresenter = new WpfSwapChainPresenter(Dispatcher.CurrentDispatcher);
            var replayer           = new Replayer(
                _selectionService.SelectedFrame.Model, _selectionService.SelectedEvent.Model,
                swapChainPresenter,
                _selectionService.SelectedFrame.ActiveRenderTargetViewIdentifier,
                _selectionService.SelectedFrame.ActiveRenderTargetArraySlice,
                e.SelectedPixel.X, e.SelectedPixel.Y);

            Task.Factory.StartNew(() =>
            {
                replayer.Replay();

                var events = replayer.Logger.GetPixelHistoryEvents(_selectionService.SelectedFrame.Number);
                _pixelEvents.AddRange(events.Select(x => new PixelHistoryEventViewModel(x)));

                FinalFrameBufferColor = ((ColorResultViewModel)_pixelEvents.Last(x => x.Result is ColorResultViewModel).Result).Result;
            });
        }
Ejemplo n.º 2
0
        private void SetButtons()
        {
            if (this.DefaultButton == null)
            {
                if (_defaultResult == MessageBoxResult.None && this.ButtonList.Any())
                {
                    this.DefaultButton = _buttonList[0];
                }
                else
                {
                    throw new ArgumentException("DefaultButton set to a button which doesn't appear in Buttons");
                }
            }

            if (this.CancelButton != null)
            {
                return;
            }
            if (_cancelResult == MessageBoxResult.None && this.ButtonList.Any())
            {
                this.CancelButton = _buttonList.Last();
            }
            else
            {
                throw new ArgumentException("CancelButton set to a button which doesn't appear in Buttons");
            }
        }
        public void AddInventoryType(object dataContext)
        {
            var inventoryTypeAddViewModel = (InventoryTypeAddViewModel)dataContext;

            m_Repository.InventoryTypes.Add(inventoryTypeAddViewModel.Model);
            Save();
            SelectedInventoryType = m_InventoryTypes.Last();
        }
Ejemplo n.º 4
0
        public void AddBuilding(object dataContext)
        {
            var buildingAddViewModel = (BuildingAddViewModel)dataContext;

            m_Repository.Buildings.Add(buildingAddViewModel.Model);
            Save();
            SelectedBuilding = m_Buildings.Last();
        }
Ejemplo n.º 5
0
        public void AddCatalog(object dataContext)
        {
            var catalogAddViewModel = ((CatalogAddViewModel)dataContext);

            m_Repository.Catalogs.Add(catalogAddViewModel.Model);
            Save();
            SelectedCatalog = m_Catalogs.Last();
        }
Ejemplo n.º 6
0
        public void AddCustomer(object dataContext)
        {
            var customerAddViewModel = ((CustomerAddViewModel)dataContext);

            m_Repository.Customers.Add(customerAddViewModel.Model);
            m_Repository.Save();
            CloseEditor();
            SelectedCustomer = m_Customers.Last();
        }
Ejemplo n.º 7
0
        private void RepositoryOnSaveCompleted(object sender, EventArgs eventArgs)
        {
            m_Repository.ReloadSurveyTypes();
            LoadSurveyTypes();

            SelectedSurvey     = m_SurveyTypeList.Last();
            SelectedSurveyName = null;
            //m_SurveyParserServiceClient.GenerateSurveyAsync(SelectedSurvey.Model.Id);
            m_SurveyParserServiceClient.GenerateSurvey(SelectedSurvey.Model.Id);
        }
Ejemplo n.º 8
0
        public void AddMeter(object dataContext)
        {
            var meterAddViewModel = ((MeterAddViewModel)dataContext);

            m_Repository.Meter.Add(meterAddViewModel.Model);
            NotifyOfPropertyChange(() => FilteredMeters);
            SelectedMeter = m_Meters.Last();
            CloseEditor();
            Save();
        }
Ejemplo n.º 9
0
        public void AddMap(object dataContext)
        {
            var mapViewModel = ((MapAddViewModel)dataContext);

            m_Repository.Maps.Add(mapViewModel.Model);
            NotifyOfPropertyChange(() => Maps);
            SelectedMap = m_Maps.Last();
            CloseEditor();
            Save();
        }
Ejemplo n.º 10
0
        public void AddCompany(object dataContext)
        {
            var companyAddViewModel = ((CompanyAddViewModel)dataContext);

            m_Repository.Companies.Add(companyAddViewModel.Model);
            CloseEditor();
            Save();
            SelectedCompanyViewModel = m_CompanyViewModels.Last();
            NotifyOfPropertyChange(() => ActivateTabEnabled);
        }
Ejemplo n.º 11
0
        public void AddDisposer(object dataContext)
        {
            var disposerAddViewModel = ((DisposerAddViewModel)dataContext);

            disposerAddViewModel.Accept();
            m_Repository.Disposer.Add(disposerAddViewModel.Model);
            Save();

            LoadDisposersAndWasteContainers();
            SelectedDisposer = m_Disposers.Last();
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TimeLineViewmodel"/> class.
        /// </summary>
        /// <param name="events">The events aggregator.</param>
        public TimeLineViewModel(IEventAggregator events)
        {
            _events = events;
            _events.Subscribe(this);

            TimeLineItems = new BindableCollection <TimeLineItemViewModel>();
            TimeLineItems.Add(new TimeLineItemViewModel(this));

            SelectedTimeLineItem = TimeLineItems.Last();

            _sendInputs = true;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TimeLineViewmodel"/> class.
        /// </summary>
        /// <param name="events">The events aggregator.</param>
        public TimeLineViewModel(IEventAggregator events)
        {
            _events = events;
            _events.Subscribe(this);

            TimeLineItems = new BindableCollection <TimeLineItemViewModel>();
            TimeLineItems.Add(new TimeLineItemViewModel(this));

            SelectedTimeLineItem = TimeLineItems.Last();

            _autoSwitchToSF4 = true;
            _isSteamVersion  = true;
        }
Ejemplo n.º 14
0
        public void AddPlant(object dataContext)
        {
            var plantAddViewModel = (PlantAddViewModel)dataContext;

            m_PlantViewModels.Add(m_PlantManagementViewModelFactory.CreatePlantViewModel(plantAddViewModel.Plant));
            m_Repository.Plants.Add(plantAddViewModel.Plant);
            m_Repository.Save();

            NotifyOfPropertyChange(() => CanCreateNewPermission);

            CloseEditor();

            SelectedPlantViewModel = m_PlantViewModels.Last();
        }
        /// <summary>
        ///     Добавить сезоны
        /// </summary>
        public void AddSeasons()
        {
            var number     = Seasons.Count;
            var lastNumber = Seasons.LastOrDefault()?.Number ?? 0;
            var seasons    = new List <Season>();

            for (var i = 0; i < AddingSeasonValue; i++)
            {
                if (number > 0 && number != lastNumber)
                {
                    for (var j = 1; j <= lastNumber; j++)
                    {
                        if (Seasons.Any(s => s.Number == j) ||
                            seasons.Any(s => s.Number == j))
                        {
                            continue;
                        }

                        seasons.Add(new Season
                        {
                            Number = j,
                            Film   = CurrentFilm
                        });
                        lastNumber++;
                        break;
                    }

                    continue;
                }

                seasons.Add(new Season
                {
                    Number = ++number,
                    Film   = CurrentFilm
                });

                lastNumber++;
            }

            InsertEntityListToDb(seasons);
            Seasons        = new BindableCollection <Season>(CurrentFilm.Seasons);
            SelectedSeason = Seasons.Last();
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Setup the MessageBoxViewModel with the information it needs
        /// </summary>
        /// <param name="messageBoxText">A System.String that specifies the text to display.</param>
        /// <param name="caption">A System.String that specifies the title bar caption to display.</param>
        /// <param name="buttons">A System.Windows.MessageBoxButton value that specifies which button or buttons to display.</param>
        /// <param name="icon">A System.Windows.MessageBoxImage value that specifies the icon to display.</param>
        /// <param name="defaultResult">A System.Windows.MessageBoxResult value that specifies the default result of the message box.</param>
        /// <param name="cancelResult">A System.Windows.MessageBoxResult value that specifies the cancel result of the message box</param>
        /// <param name="options">A System.Windows.MessageBoxOptions value object that specifies the options.</param>
        /// <param name="buttonLabels">A dictionary specifying the button labels, if desirable</param>
        public void Setup(
            string messageBoxText,
            string caption = null,
            MessageBoxButton buttons = MessageBoxButton.OK,
            MessageBoxImage icon = MessageBoxImage.None,
            MessageBoxResult defaultResult = MessageBoxResult.None,
            MessageBoxResult cancelResult = MessageBoxResult.None,
            MessageBoxOptions options = MessageBoxOptions.None,
            IDictionary<MessageBoxResult, string> buttonLabels = null)
        {
            this.Text = messageBoxText;
            this.DisplayName = caption;
            this.Icon = icon;

            var buttonList = new BindableCollection<LabelledValue<MessageBoxResult>>();
            this.ButtonList = buttonList;
            foreach (var val in ButtonToResults[buttons])
            {
                string label;
                if (buttonLabels == null || !buttonLabels.TryGetValue(val, out label))
                    label = ButtonLabels[val];
                    
                var lbv = new LabelledValue<MessageBoxResult>(label, val);
                buttonList.Add(lbv);
                if (val == defaultResult)
                    this.DefaultButton = lbv;
                else if (val == cancelResult)
                    this.CancelButton = lbv;
            }
            // If they didn't specify a button which we showed, then pick a default, if we can
            if (this.DefaultButton == null)
            {
                if (defaultResult == MessageBoxResult.None && this.ButtonList.Any())
                    this.DefaultButton = buttonList[0];
                else
                    throw new ArgumentException("DefaultButton set to a button which doesn't appear in Buttons");
            }
            if (this.CancelButton == null)
            {
                if (cancelResult == MessageBoxResult.None && this.ButtonList.Any())
                    this.CancelButton = buttonList.Last();
                else
                    throw new ArgumentException("CancelButton set to a button which doesn't appear in Buttons");
            }

            this.FlowDirection = options.HasFlag(MessageBoxOptions.RtlReading) ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
            this.TextAlignment = (options.HasFlag(MessageBoxOptions.RightAlign) == options.HasFlag(MessageBoxOptions.RtlReading)) ? TextAlignment.Left : TextAlignment.Right;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Setup the MessageBoxViewModel with the information it needs
        /// </summary>
        /// <param name="messageBoxText">A <see cref="string"/> that specifies the text to display.</param>
        /// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
        /// <param name="buttons">A <see cref="System.Windows.MessageBoxButton"/> value that specifies which button or buttons to display.</param>
        /// <param name="icon">A <see cref="System.Windows.MessageBoxImage"/> value that specifies the icon to display.</param>
        /// <param name="defaultResult">A <see cref="System.Windows.MessageBoxResult"/> value that specifies the default result of the message box.</param>
        /// <param name="cancelResult">A <see cref="System.Windows.MessageBoxResult"/> value that specifies the cancel result of the message box</param>
        /// <param name="buttonLabels">A dictionary specifying the button labels, if desirable</param>
        /// <param name="flowDirection">The <see cref="System.Windows.FlowDirection"/> to use, overrides the <see cref="MessageBoxViewModel.DefaultFlowDirection"/></param>
        /// <param name="textAlignment">The <see cref="System.Windows.TextAlignment"/> to use, overrides the <see cref="MessageBoxViewModel.DefaultTextAlignment"/></param>
        public void Setup(
            string messageBoxText,
            string caption                 = null,
            MessageBoxButton buttons       = MessageBoxButton.OK,
            MessageBoxImage icon           = MessageBoxImage.None,
            MessageBoxResult defaultResult = MessageBoxResult.None,
            MessageBoxResult cancelResult  = MessageBoxResult.None,
            IDictionary <MessageBoxResult, string> buttonLabels = null,
            FlowDirection?flowDirection = null,
            TextAlignment?textAlignment = null)
        {
            this.Text        = _languageService.ReplaceKeyToEntry(messageBoxText);
            this.DisplayName = _languageService.ReplaceKeyToEntry(caption);
            this.Icon        = icon;

            var buttonList = new BindableCollection <LabelledValue <MessageBoxResult> >();

            this.ButtonList = buttonList;
            foreach (var val in ButtonToResults[buttons])
            {
                if (buttonLabels == null || !buttonLabels.TryGetValue(val, out string label))
                {
                    label = ButtonLabels[val];
                }

                var lbv = new LabelledValue <MessageBoxResult>(label, val);
                buttonList.Add(lbv);
                if (val == defaultResult)
                {
                    this.DefaultButton = lbv;
                }
                else if (val == cancelResult)
                {
                    this.CancelButton = lbv;
                }
            }
            // If they didn't specify a button which we showed, then pick a default, if we can
            if (this.DefaultButton == null)
            {
                if (defaultResult == MessageBoxResult.None && this.ButtonList.Any())
                {
                    this.DefaultButton = buttonList[0];
                }
                else
                {
                    throw new ArgumentException("DefaultButton set to a button which doesn't appear in Buttons");
                }
            }
            if (this.CancelButton == null)
            {
                if (cancelResult == MessageBoxResult.None && this.ButtonList.Any())
                {
                    this.CancelButton = buttonList.Last();
                }
                else
                {
                    throw new ArgumentException("CancelButton set to a button which doesn't appear in Buttons");
                }
            }

            this.FlowDirection = flowDirection ?? DefaultFlowDirection;
            this.TextAlignment = textAlignment ?? DefaultTextAlignment;
        }
Ejemplo n.º 18
0
        public CarManager()
        {
            try
            {
                Cars = new BindableCollection <Car>();
                List <string> lines = File.ReadAllLines(path).ToList();

                foreach (string line in lines)
                {
                    /*
                     * int startIndex = 0;
                     * int lastIndex = line.IndexOf(',');
                     * List<string> words = new List<string>();
                     * while (lastIndex < line.Length && lastIndex != -1)
                     * {
                     *  words.Add(line.Substring(startIndex, lastIndex - startIndex));
                     *  startIndex = lastIndex + 1;
                     *  lastIndex = line.IndexOf(',', startIndex);
                     * }
                     * words.Add(line.Substring(startIndex, line.Length - startIndex));
                     */

                    List <string> words = new List <string>(line.Split(';'));

                    Cars.Add(new Car(words[0], words[1], words[2], words[3], words[4],
                                     words[5], words[6], words[7], words[8], words[9],
                                     words[10], words[11], words[12], words[13], words[14],
                                     words[15], words[16]));
                }
                if (Cars.Any())
                {
                    SelectedCar = Cars.Last();
                }
                MessageBox.Show("Data seccessfully loaded.", "Loaded", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (ArgumentException argEx)
            {
                MessageBox.Show(argEx.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (PathTooLongException pathLongEx)
            {
                MessageBox.Show(pathLongEx.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (DirectoryNotFoundException dirNotFound)
            {
                MessageBox.Show(dirNotFound.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (IOException IOEx)
            {
                MessageBox.Show(IOEx.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (UnauthorizedAccessException unAuthorisedEx)
            {
                MessageBox.Show(unAuthorisedEx.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (NotSupportedException notSuporptedEx)
            {
                MessageBox.Show(notSuporptedEx.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (SecurityException securityEx)
            {
                MessageBox.Show(securityEx.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }