コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsViewModel" /> class.
        /// </summary>
        /// <param name="windowManager">The window manager.</param>
        /// <param name="keyboardHelper">The keyboard helper.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="hotkeyService">The key code service.</param>
        /// <param name="soundService">The sound service.</param>
        /// <param name="githubService">The github service.</param>
        /// <param name="pushBulletService">The PushBullet service.</param>
        public SettingsViewModel(
            IWindowManager windowManager,
            KeyboardHelper keyboardHelper,
            SettingsService settingsService,
            HotkeyService hotkeyService,
            SoundService soundService,
            GithubService githubService,
            PushBulletService pushBulletService)
            : base(windowManager)
        {
            this._keyboardHelper       = keyboardHelper;
            this._settingService       = settingsService;
            this._hotkeyService        = hotkeyService;
            this._soundService         = soundService;
            this.DisplayName           = "Settings";
            this._excludePropertyNames = this.GetExcludedPropertyNames();
            this.PropertyChanged      += this.SettingsViewModel_PropertyChanged;

            if (!AssetService.Exists(LottieFileName))
            {
                AssetService.Create(LottieFileName, GetResourceContent(LottieFileName));
            }

            this.BuildManager = new BuildManagerViewModel(this.ShowMessage, githubService);
            this.PushBullet   = new PushBulletViewModel(pushBulletService);
            this.SetupHotkeys();
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SplashscreenViewModel" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        public SplashscreenViewModel(SettingsViewModel settings, IEventAggregator eventAggregator)
        {
            this._settings      = settings;
            this._eventAggrator = eventAggregator;
            if (!AssetService.Exists(LottieFileName))
            {
                AssetService.Create(LottieFileName, GetResourceContent(LottieFileName));
            }

            Execute.OnUIThread(async() =>
            {
                using (var service = new PatreonService())
                {
                    var result = await service.IsPledging();
                    if (result)
                    {
                        return;
                    }

                    this.ShowPatreon    = true;
                    this.TrialAvailable = service.TrialAvailable;
                    if (!this.TrialAvailable)
                    {
                        // this.ShowPatreon = true;
                    }
                }
            });
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SplashscreenViewModel"/> class.
 /// </summary>
 public SplashscreenViewModel()
 {
     if (!AssetService.Exists(LottieFileName))
     {
         AssetService.Create(LottieFileName, GetResourceContent(LottieFileName));
     }
 }
コード例 #4
0
ファイル: BuildViewModel.cs プロジェクト: Rhulen/Poe-Lurker
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildViewModel"/> class.
        /// </summary>
        /// <param name="windowManager">The window manager.</param>
        /// <param name="dockingHelper">The docking helper.</param>
        /// <param name="processLurker">The process lurker.</param>
        /// <param name="settingsService">The settings service.</param>
        public BuildViewModel(IWindowManager windowManager, DockingHelper dockingHelper, ProcessLurker processLurker, SettingsService settingsService)
            : base(windowManager, dockingHelper, processLurker, settingsService)
        {
            if (AssetService.Exists(FileName))
            {
                this._currentTask = this.Initialize(File.ReadAllText(AssetService.GetFilePath(FileName)));
            }
            else
            {
                this._hasNoBuild = true;
            }

            this.IsVisible = true;
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsViewModel" /> class.
        /// </summary>
        /// <param name="windowManager">The window manager.</param>
        /// <param name="keyboardHelper">The keyboard helper.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="soundService">The sound service.</param>
        public SettingsViewModel(IWindowManager windowManager, KeyboardHelper keyboardHelper, SettingsService settingsService, SoundService soundService)
            : base(windowManager)
        {
            this._keyboardHelper = keyboardHelper;
            this._settingService = settingsService;
            this._soundService   = soundService;
            this.DisplayName     = "Settings";

            this.PropertyChanged += this.SettingsViewModel_PropertyChanged;

            if (!AssetService.Exists(LottieFileName))
            {
                AssetService.Create(LottieFileName, GetResourceContent(LottieFileName));
            }
        }
コード例 #6
0
        private void RezAttachment(UUID itemID, AttachmentPoint attachpointFlagged)
        {
            InventoryItem item;

            try
            {
                item = InventoryService.Item[ID, itemID];
            }
            catch
            {
                SendAlertMessage("ALERT: CantFindInvItem", SceneID);
                return;
            }
            if (item.AssetType != AssetType.Object)
            {
                SendAlertMessage("ALERT: InvalidObjectParams", SceneID);
                return;
            }

            var accessFailed = false;

            try
            {
                accessFailed = !AssetService.Exists(item.AssetID);
            }
            catch (Exception e)
            {
                m_Log.WarnFormat("Attaching item {0} / asset {1} not possible due {2}: {3}", item.ID, item.AssetID, e.GetType().FullName, e.ToString());
                SendAlertMessage("ALERT: CantFindInvItem", SceneID);
                return;
            }

            if (accessFailed)
            {
                m_Log.WarnFormat("Attaching item {0} / asset {1} not possible since it is missing", item.ID, item.AssetID);
                SendAlertMessage("ALERT: CantFindInvItem", SceneID);
                return;
            }

            new RezAttachmentHandler(
                Circuits[SceneID].Scene,
                item.AssetID,
                AssetService,
                Owner,
                attachpointFlagged,
                Attachments,
                item).QueueWorkItem();
        }
コード例 #7
0
        private void AddTaskInventoryItem(UpdateTaskInventory req, IAgent agent, ObjectPart part)
        {
            switch (req.InvType)
            {
            case InventoryType.Animation:
            case InventoryType.Attachable:
            case InventoryType.CallingCard:
            case InventoryType.Gesture:
            case InventoryType.Landmark:
            case InventoryType.Notecard:
            case InventoryType.Object:
            case InventoryType.Snapshot:
            case InventoryType.Sound:
            case InventoryType.Texture:
            case InventoryType.Wearable:
                break;

            default:
                /* do not allow anything else than the ones above */
                return;
            }

            switch (req.AssetType)
            {
            case AssetType.LSLText:
            case AssetType.LSLBytecode:
            case AssetType.Link:
            case AssetType.LinkFolder:
                /* no addition here of scripts, item links or folder links */
                return;

            default:
                break;
            }

            if (part.IsAllowedDrop)
            {
                /* llAllowInventoryDrop active, so we can drop anything except scripts */
            }
            else if (!CanEdit(agent, part.ObjectGroup, part.ObjectGroup.GlobalPosition))
            {
                /* not allowed */
                return;
            }

            InventoryItem agentItem;

            if (agent.InventoryService.Item.TryGetValue(agent.Owner.ID, req.ItemID, out agentItem) &&
                agentItem.AssetType == req.AssetType &&
                agentItem.InventoryType == req.InvType)
            {
                var item = new ObjectPartInventoryItem(UUID.Random, agentItem);
                AdjustPermissionsAccordingly(agent, part.Owner, item);
                item.LastOwner = item.Owner;
                item.Owner     = part.Owner;

                if (AssetService.Exists(agentItem.AssetID))
                {
                    /* no need for an assettransferer here */

                    if ((item.Permissions.Base & InventoryPermissionsMask.Transfer) == 0)
                    {
                        part.OwnerMask &= ~InventoryPermissionsMask.Transfer;
                    }

                    if (item.AssetType.IsNoCopyAffectingContainingObject() && (item.Permissions.Base & InventoryPermissionsMask.Copy) == 0)
                    {
                        part.OwnerMask &= ~InventoryPermissionsMask.Copy;
                    }

                    part.Inventory.Add(item);

                    part.SendObjectUpdate();

                    SendObjectPropertiesToAgent(agent, part);

                    if (agentItem.CheckPermissions(agent.Owner, agent.Group, InventoryPermissionsMask.Copy))
                    {
                        agent.InventoryService.Item.Delete(agent.Owner.ID, agentItem.ID);
                    }
                }
                else
                {
                    new AddToObjectTransferItem(agent, this, item.AssetID, part, item).QueueWorkItem();
                }
            }
        }