private static void PreviewWem(PropertiesViewModel propertiesViewModel, IFileSystemViewModel selectedItem, IGameFile selectedGameFile)
        {
            propertiesViewModel.IsAudioPreviewVisible = true;

            var managerCacheDir = ISettingsManager.GetTemp_Audio_importPath();

            _ = Directory.CreateDirectory(managerCacheDir);

            var endPath = Path.Combine(managerCacheDir, Path.GetFileName(selectedItem.Name) ?? throw new InvalidOperationException());

            foreach (var f in Directory.GetFiles(managerCacheDir))
            {
                try
                {
                    File.Delete(f);
                }
                catch
                {
                    // ignored
                }
            }

            using (var fs = new FileStream(endPath, FileMode.Create, FileAccess.Write))
            {
                selectedGameFile.Extract(fs);
            }

            if (File.Exists(endPath))
            {
                propertiesViewModel.AddAudioItem(endPath);
            }
        }
示例#2
0
        public BlocksDocumentsViewModel(PropertiesViewModel properties) : base(properties)
        {
            ShowRichRendererPreview();
            ShowTransformedCardPreview();

            PropertyChanged += BlocksDocumentsViewModel_PropertyChanged;
        }
示例#3
0
        private void LayoutSerializer_LayoutSerializationCallback(object sender, LayoutSerializationCallbackEventArgs e)
        {
            var mvm = this.DataContext as MainWindowViewModel;

            if (e.Model.ContentId == null)
            {
                e.Cancel = true;
                return;
            }

            if (e.Model.ContentId.Equals(Korduene.UI.WPF.Constants.ContentIds.TOOLBOX, StringComparison.OrdinalIgnoreCase))
            {
                var vm = new ToolBoxViewModel();
                e.Content = vm;
                mvm.AddToolsInternal(vm);
            }
            else if (e.Model.ContentId.Equals(Korduene.UI.WPF.Constants.ContentIds.PROPERTIES, StringComparison.OrdinalIgnoreCase))
            {
                var vm = new PropertiesViewModel();
                e.Content = vm;
                mvm.AddToolsInternal(vm);
            }
            else if (e.Model.ContentId.Equals(Korduene.UI.WPF.Constants.ContentIds.SOLUTION_EXPLORER, StringComparison.OrdinalIgnoreCase))
            {
                var vm = new SolutionExplorerViewModel();
                e.Content = vm;
                mvm.AddToolsInternal(vm);
            }
            else if (e.Model.ContentId.Equals(Korduene.UI.WPF.Constants.ContentIds.OUTPUT, StringComparison.OrdinalIgnoreCase))
            {
                var vm = new OutputViewModel();
                e.Content = vm;
                mvm.AddToolsInternal(vm);
            }
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void view_InitNewRow(object sender, DevExpress.Xpf.Grid.InitNewRowEventArgs e)
        {
            PropertiesViewModel vm = this.DataContext as PropertiesViewModel;

            vm.SelectedRelation.PhotoURI = @"C:\HVCC\Photos\HVCC.jpg";
            //Relationship row = this.relationshipGrid.GetRow(e.RowHandle) as Relationship;
        }
 public static BlocksDocumentViewModel CreateNew(PropertiesViewModel properties)
 {
     return(new BlocksDocumentViewModel(properties)
     {
         _payload = @"{\n  ""title"": ""My title"",\n  ""subtitle"": ""My subtitle""\n}"
     });
 }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void view_ValidateRow(object sender, GridRowValidationEventArgs e)
        {
            //Relationship row = this.relationshipGrid.GetRow(e.RowHandle) as Relationship;
            PropertiesViewModel viewModel = this.DataContext as PropertiesViewModel;

            Relationship row = e.Row as Relationship;

            if (null != row)
            {
                string results = ValidationRules.IsRelationshipValid(row);
                if (!String.IsNullOrEmpty(results))
                {
                    e.IsValid      = false;
                    e.ErrorType    = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;
                    e.ErrorContent = "The highlighted field cannot be blank";
                    e.SetError(e.ErrorContent);


                    Style style     = new Style();
                    Style baseStyle = FindResource(new GridRowThemeKeyExtension()
                    {
                        ResourceKey = GridRowThemeKeys.LightweightCellStyle, ThemeName = ThemeManager.ApplicationThemeName
                    }) as Style;
                    style.BasedOn    = baseStyle;
                    style.TargetType = typeof(LightweightCellEditor);
                    style.Setters.Add(new Setter(LightweightCellEditor.BackgroundProperty, new SolidColorBrush(Colors.LightPink)));

                    //// TO-DO.... figure out how to set the style on the control
                    this.viewFName.Style = style;
                }
                //// TO-DO: figure out how to set the IsDirty property......
            }
        }
示例#7
0
        public async Task UpdateBlockCyclePropertyAsync(PropertiesViewModel updateBlockCyclePropertyRequest)
        {
            try
            {
                var param = new DynamicParameters();
                param.Add("BlockCycleId", updateBlockCyclePropertyRequest.BlockCycleId, dbType: DbType.Int32);
                param.Add("PropertyId", updateBlockCyclePropertyRequest.PropertyId, dbType: DbType.Int32);
                param.Add("StatusId", updateBlockCyclePropertyRequest.StatusId, dbType: DbType.Int32);
                param.Add("AmPm", updateBlockCyclePropertyRequest.AmPm, dbType: DbType.String);
                param.Add("NextInspectionDate", updateBlockCyclePropertyRequest.NextInspectionDate, dbType: DbType.DateTime);
                param.Add("Comments", updateBlockCyclePropertyRequest.Comments, dbType: DbType.String);
                param.Add("LastUpdatedBy", updateBlockCyclePropertyRequest.LastUpdatedBy, dbType: DbType.Int32);

                _logger.LogInformation("Calling stored procedure [BlockCycle].[UpdateBlockCycleProperty] with blockCycle : {@0}", updateBlockCyclePropertyRequest);
                await WithConnection(async c =>
                {
                    return(await c.ExecuteAsync("BlockCycle.UpdateBlockCycleProperty", param, commandType: CommandType.StoredProcedure));
                });
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                throw new Exception(ex.Message);
            }
        }
示例#8
0
 public PropertiesView()
 {
     this.InitializeComponent();
     Instance         = this;
     this.ViewModel   = new PropertiesViewModel();
     this.DataContext = this.ViewModel;
 }
示例#9
0
        private async void PreviewTexture(PropertiesViewModel propertiesViewModel, FileEntryViewModel selectedItem, IGameFile selectedGameFile)
        {
            propertiesViewModel.IsImagePreviewVisible = true;

            var man = ServiceLocator.Default.ResolveType <ModTools>();

            // extract cr2w to stream
            await using var cr2wstream = new MemoryStream();
            selectedGameFile.Extract(cr2wstream);

            // convert xbm to dds stream
            await using var ddsstream = new MemoryStream();
            var expargs = new XbmExportArgs {
                Flip = false, UncookExtension = EUncookExtension.tga
            };

            man.ConvertXbmToDdsStream(cr2wstream, ddsstream, out _);

            // try loading it in pfim
            try
            {
                var qa = await ImageDecoder.RenderToBitmapSourceDds(ddsstream);

                if (qa != null)
                {
                    StaticReferences.GlobalPropertiesView.LoadImage(qa);
                }
            }
            catch (Exception) { }
        }
        private static void PreviewMesh(PropertiesViewModel propertiesViewModel, RedFileViewModel selectedItem, IGameFile selectedGameFile)
        {
            propertiesViewModel.AB_MeshPreviewVisible = true;

            var managerCacheDir = ISettingsManager.GetTemp_MeshPath();

            _ = Directory.CreateDirectory(managerCacheDir);
            foreach (var f in Directory.GetFiles(managerCacheDir))
            {
                try
                {
                    File.Delete(f);
                }
                catch
                {
                    // ignored
                }
            }

            using (var meshStream = new MemoryStream())
            {
                selectedGameFile.Extract(meshStream);
                meshStream.Seek(0, SeekOrigin.Begin);
                string outPath = Path.Combine(ISettingsManager.GetTemp_OBJPath(), Path.GetFileName(selectedItem.Name) ?? throw new InvalidOperationException());
                outPath = Path.ChangeExtension(outPath, ".glb");
                if (Locator.Current.GetService <MeshTools>().ExportMeshPreviewer(meshStream, new FileInfo(outPath)))
                {
                    propertiesViewModel.LoadModel(outPath);
                }
                meshStream.Dispose();
                meshStream.Close();
            }
        }
示例#11
0
 private void EditValueChanges(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
 {
     if (typeof(BitmapImage) == e.NewValue.GetType())
     {
         PropertiesViewModel vm = this.DataContext as PropertiesViewModel;
         vm.SelectedRelation.PhotoURI = vm.SaveNewImage(e.NewValue as BitmapImage);
     }
 }
示例#12
0
        public PropertiesView(PropertiesViewModel viewModel)
        {
            InitializeComponent();
            this.DataContext = viewModel;


            // The following line simply forces Visual Studio to copy the
            // WPF Toolkit DLL to the output folder.
            _propertyGrid = null;
        }
示例#13
0
        private PropertiesViewModel CreatePropertiesViewModel(TimeSpan?ttl)
        {
            var name  = Key.FullName;
            var props = new PropertiesViewModel(name, ttl);

            props.ValueSaved += async(sender, args) => await OnPropertiesSaved();

            props.ValueDiscarded += (sender, args) => OnPropertiesDiscarded();
            return(props);
        }
示例#14
0
        public ActionResult GetClientProperties([DataSourceRequest] DataSourceRequest request, int?clientId)
        {
            Contract.Requires <ArgumentNullException>(request.IsNotNull());
            int resolvedClientId      = this.ResolveClientId(clientId);
            PropertiesViewModel model = this.clientProfileManager.GetPropertiesViewModel(resolvedClientId);

            PropertyViewModel[] properies = model.Properties.ToArray();

            return(Json(properies.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }
        public async Task <IActionResult> UpdateBlockCycleProperty([FromBody] PropertiesViewModel request)
        {
            _logger.LogInformation("Calling UpdateBlockCycleProperty from PropertiesController with request : {@0}", request);
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            await _propertiesAppService.UpdateBlockCyclePropertyAsync(request);

            return(Ok());
        }
示例#16
0
        public ActionResult MakeOffer(MakeOfferCommand command)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var handler = new MakeOfferCommandHandler(_context);

                    command.BuyerUserId = User.Identity.GetUserId();

                    if (!handler.Handle(command))
                    {
                        ModelState.AddModelError("", "You already placed an offer.");
                    }
                    else
                    {
                        return(RedirectToAction("Index"));
                    }
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", "Adding offer failed.");
            }
            var property = _context.Properties.Find(command.PropertyId);

            MakeOfferViewModel model = new MakeOfferViewModel
            {
                PropertyId   = property.Id,
                PropertyType = property.PropertyType,
                StreetName   = property.StreetName,
                Offer        = property.SuggestedAskingPrice
            };

            PropertiesViewModel m = new PropertiesViewModel
            {
                Search     = "",
                Properties = new System.Collections.Generic.List <PropertyViewModel>
                {
                    new PropertyViewModel
                    {
                        Id                   = property.Id,
                        PropertyType         = property.PropertyType,
                        StreetName           = property.StreetName,
                        Description          = property.Description,
                        NumberOfBedrooms     = property.NumberOfBedrooms,
                        IsListedForSale      = property.IsListedForSale,
                        SuggestedAskingPrice = property.SuggestedAskingPrice
                    }
                }
            };

            return(View("Index", m));
        }
示例#17
0
        private void FillPropertiesTable()
        {
            var node = Models.CurrentModel?.CurrentNode;

            if (node == null)
            {
                return;
            }

            var typeName = "Xamarin.Forms." + node.Name;
            var type     = Toolbox.GetType(typeName);

            if (type == null)
            {
                return;
            }

            var parent = (TabItem)_propertiesTree.Parent;

            PropertyViewModel.PropertiesKind kind;
            switch (parent.Uid)
            {
            case "AllPropertiesPage":
                kind = PropertyViewModel.PropertiesKind.All;
                break;

            case "AssignedPropertiesPage":
                kind = PropertyViewModel.PropertiesKind.Assigned;
                break;

            default:
                kind = PropertyViewModel.PropertiesKind.All;
                break;
            }

            PropertiesViewModel = new PropertiesViewModel(type, node);

            _propertiesTree.DataContext = PropertiesViewModel;
            switch (kind)
            {
            case PropertyViewModel.PropertiesKind.All:
                _propertiesTree.ItemsSource = PropertiesViewModel.Properties;
                break;

            case PropertyViewModel.PropertiesKind.Assigned:
                _propertiesTree.ItemsSource = PropertiesViewModel.AssignedProperties;
                break;
            }

            var propertiesSearchPanel = (StackPanel)GetByUid(PropertiesToolbox, "PropertiesSearchPanel");

            propertiesSearchPanel.DataContext = PropertiesViewModel;
        }
示例#18
0
        public PropertiesViewModel GetPropertiesViewModel(int resolvedClientId)
        {
            Contract.Requires <ArgumentOutOfRangeException>(resolvedClientId.IsPositive());
            IEnumerable <Property> properties = this.clientProfileService.GetClientProperties(resolvedClientId);

            var model = new PropertiesViewModel
            {
                ClientId   = resolvedClientId,
                Properties = MapToPropertyViewModel(properties.ToList())
            };

            return(model);
        }
示例#19
0
        /// <summary>
        /// Invoked from the class constructor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="routedEventArgs"></param>
        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            PropertiesViewModel vm = ((PropertiesViewModel)this.DataContext);

            //// Bind the properties of the view  to the properties of the FileInformation view model.
            //// The properties are INotify, so when one changes it registers a PropertyChange
            //// event on the other.  Also note, this code must reside outside of the
            //// constructor or a XAML error will be thrown.
            if (null != vm)
            {
                vm.PropertyChanged +=
                    new System.ComponentModel.PropertyChangedEventHandler(this.PropertiesViewModel_PropertyChanged);
            }
        }
示例#20
0
        public ActionResult Index()
        {
            List <Property>            properties = repo.GetAll();
            List <PropertiesViewModel> model      = new List <PropertiesViewModel>();

            foreach (var p in properties)
            {
                PropertiesViewModel pm = new PropertiesViewModel(p);

                model.Add(pm);
            }

            return(View(model));
        }
示例#21
0
        public void Index()
        {
            //Arrange - is done by the class Setup
            // Act
            var result = _controller.Index(new PropertiesQuery());

            // Assert
            Assert.IsAssignableFrom(typeof(ViewResult), result);
            ViewResult viewResult = result as ViewResult;

            Assert.IsAssignableFrom(typeof(PropertiesViewModel), viewResult.Model);
            PropertiesViewModel model = viewResult.Model as PropertiesViewModel;

            Assert.True(model.Properties.Count() == 2); // 2 properties for sale
            Assert.False(model.Properties.Any(p => !p.IsListedForSale));
        }
示例#22
0
        public PartialViewResult GetPropertiesView(long uri)
        {
            var hvm = new PropertiesViewModel();

            if (AppUserState == null || AppUserState.Connected == false)
            {
                return(null);
            }
            var conn = new InforConnection(tu: _tu, tup: _tup);
            var rec  = (InforRecord)conn.GetRecordWeb(uri, AppUserState.UserName, AppUserState.Wgs, AppUserState.Ds);

            hvm.RecordNumber = rec.RecordNumber;
            hvm.RecordUri    = rec.Uri;
            hvm.Title        = rec.Title;
            hvm.Properties   = rec.Properties;
            return(PartialView("_Properties", hvm));
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method determines if the delete command can execute.</summary>
        ///
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        ///--------------------------------------------------------------------------------
        private void PreviewDeleteCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            PropertiesViewModel items = DataContext as PropertiesViewModel;

            if (items != null)
            {
                foreach (PropertyViewModel item in items.Properties)
                {
                    if (item.IsSelected == true)
                    {
                        e.CanExecute = true;
                        return;
                    }
                }
            }
            e.CanExecute = false;
            e.Handled    = true;
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method handles the execution of the delete command.</summary>
        ///
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        ///--------------------------------------------------------------------------------
        private void DeleteExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            PropertiesViewModel items = DataContext as PropertiesViewModel;

            if (items != null)
            {
                foreach (PropertyViewModel item in items.Properties)
                {
                    if (item.IsSelected == true)
                    {
                        if (MessageBox.Show(DisplayValues.Message_DeleteItemConfirmation, DisplayValues.Message_DeleteItemConfirmationCaption, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                        {
                            items.DeleteProperty(item);
                        }
                        return;
                    }
                }
            }
        }
        public ActionResult _UserProperties(PropertyRentSearchModel searchModel)
        {
            PropertiesViewModel model = new PropertiesViewModel();

            try
            {
                model.SearchModel = _rent.GetProperties(searchModel);
                if (model.SearchModel.Count > 0)
                {
                    model.pager = new Pager(model.SearchModel.FirstOrDefault().TotalRows, searchModel.PageNumber, searchModel.PageSize);
                }
                else
                {
                    model.pager = new Pager(2, searchModel.PageNumber);
                }
            }
            catch { }
            return(View(model));
        }
示例#26
0
        public void Initialize()
        {
            _eventAggregator.GetEvent <SplashScreenUpdateEvent>().Publish(new SplashScreenUpdateEvent {
                Text = "Loading Properties..."
            });

            _container.RegisterType <PropertiesViewModel>(new ContainerControlledLifetimeManager());
            _container.RegisterType <IPropertiesToolboxToolbarService, PropertiesToolboxToolbarService>(new ContainerControlledLifetimeManager());
            _container.RegisterType <IPropertyGrid, PropertiesViewModel>(new ContainerControlledLifetimeManager());

            IWorkspace workspace = _container.Resolve <DefaultWorkspace>();

            _propertiesViewModel      = _container.Resolve <PropertiesViewModel>();
            _propertiesToolbarService = _container.Resolve <IPropertiesToolboxToolbarService>();

            LoadCommands();
            LoadToolbar();

            workspace.Tools.Add(_propertiesViewModel);
        }
示例#27
0
        private void PreviewMesh(PropertiesViewModel propertiesViewModel, FileEntryViewModel selectedItem, IGameFile selectedGameFile)
        {
            propertiesViewModel.AB_MeshPreviewVisible = true;

            var managerCacheDir = ISettingsManager.GetTemp_MeshPath();

            Directory.CreateDirectory(managerCacheDir);
            foreach (var f in Directory.GetFiles(managerCacheDir))
            {
                try
                { File.Delete(f); }
                catch { }
            }

            var endPath = Path.Combine(managerCacheDir, Path.GetFileName(selectedItem.Name));
            var q2      = ServiceLocator.Default.ResolveType <MeshTools>().ExportMeshWithoutRigPreviewer(selectedGameFile, endPath, ISettingsManager.GetTemp_OBJPath());

            if (q2.Length > 0)
            {
                StaticReferences.GlobalPropertiesView.LoadModel(q2);
            }
        }
        ///--------------------------------------------------------------------------------
        /// <summary>This method handles the execution of the new command.</summary>
        ///
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        ///--------------------------------------------------------------------------------
        private void NewExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            Point currentPosition                    = MouseUtilities.GetMousePosition(this);
            PropertiesViewModel    items             = DataContext as PropertiesViewModel;
            EntityDiagramControl   diagram           = VisualItemHelper.VisualUpwardSearch <EntityDiagramControl>(this) as EntityDiagramControl;
            DiagramEntityViewModel diagramEntityView = diagram.DataContext as DiagramEntityViewModel;

            if (items != null && diagramEntityView != null)
            {
                dialog         = new Window();
                dialog.Height  = 450 * UserSettingsHelper.Instance.ControlSize;
                dialog.Width   = 400 * UserSettingsHelper.Instance.ControlSize;
                dialog.Left    = Math.Max(currentPosition.X, 20);
                dialog.Top     = Math.Max(currentPosition.Y, 20);
                dialog.Content = new PropertyDialogControl();
                Property newItem = new Property();
                newItem.PropertyID = Guid.NewGuid();
                newItem.Solution   = items.Solution;
                newItem.Entity     = items.Entity;
                //newItem.ReferenceEntity = diagramEntityView.DiagramEntity.Entity;
                PropertyViewModel newItemView = new PropertyViewModel(newItem, items.Solution);
                newItemView.IsFreeDialog  = true;
                dialog.DataContext        = newItemView;
                dialog.Title              = newItemView.Title;
                newItemView.RequestClose += new EventHandler(Item_RequestClose);
                #region protected
                dialog.Width = 600 * UserSettingsHelper.Instance.ControlSize;
                #endregion protected
                dialog.ShowDialog();
                if (newItemView.IsOK == true)
                {
                    items.AddProperty(newItemView);
                }
                dialog.Close();
                dialog    = null;
                e.Handled = true;
                return;
            }
        }
示例#29
0
        public async Task <IViewComponentResult> InvokeAsync(Guid ProductId, Guid clientId, Guid policyId)
        {
            var properties = await _context.Properties
                             .Include(a => a.Policy)
                             .Include(a => a.Coverage)
                             .Include(a => a.ResidenceType)
                             .Include(a => a.WallType)
                             .Include(a => a.RoofType)
                             .AsNoTracking()
                             .Where(a => a.PolicyID == policyId)
                             .OrderBy(c => c.Location).ToListAsync();

            PropertiesViewModel viewModel = new PropertiesViewModel
            {
                ProductID  = ProductId,
                ClientID   = clientId,
                PolicyID   = policyId,
                Properties = properties
            };

            return(View(viewModel));
        }
示例#30
0
        /// <summary>
        /// Property Changed event handler for the view model
        /// </summary>
        /// <param name="sender">object invoking the method</param>
        /// <param name="e">property change event arguments</param>
        protected void PropertiesViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            PropertiesViewModel vm = this.DataContext as PropertiesViewModel;

            switch (e.PropertyName)
            {
            // TO-DO:  The property changed isn't being called when the details are changed
            case "IsDirty":
                if (vm.IsDirty)
                {
                    this.grpProperties.Header += "*";
                }
                break;

            case "PropertiesList":
                this.propertiesGrid.RefreshData();
                break;

            default:
                break;
            }
        }