Esempio n. 1
0
    private void onSelectEnd(int result)
    {
        SelectionData data = MainGame.instance.selection[result];

        if (data.setFlag > 0)
        {
            MainGame.instance.currentFlag[data.setFlag] = true;
        }
        if (data.addValueName > 0)
        {
            MainGame.instance.values[(GameValueType)data.addValueName] += data.addValueVal;
        }

        MainGame.instance.currentID = data.next;
        next();
    }
Esempio n. 2
0
    public void Set(int _id)
    {
        SelectionData data = MainGame.instance.selection[_id];

        m_ShowText.text = data.content;
        id = _id;

        if (data.requireId > 0 && !MainGame.instance.checkCondition(data.requireId))
        {
            gameObject.SetActive(false);
        }
        else
        {
            gameObject.SetActive(true);
        }
    }
        protected override void OnDragDataGet(Gdk.DragContext context, SelectionData selectionData,
                                              uint info, uint time)
        {
            switch ((DragDropTargetType)info)
            {
            case DragDropTargetType.Source:
                new DragDropList <Source> (ServiceManager.SourceManager.ActiveSource,
                                           selectionData, context.ListTargets()[0]);
                break;

            default:
                return;
            }

            base.OnDragDataGet(context, selectionData, info, time);
        }
Esempio n. 4
0
            public void SetData(SelectionData selection_data, uint info)
            {
                if (selection_data == null)
                {
                    return;
                }
                switch (info)
                {
                case TextType:
                    selection_data.Text = GetCopiedPlainText();
                    break;

                case RichTextType:
                    var rtf = RtfWriter.GenerateRtf(copiedColoredChunks, docStyle, options);
                    selection_data.Set(RTF_ATOM, UTF8_FORMAT, Encoding.UTF8.GetBytes(rtf));
                    break;

                case HTMLTextType:
                    var html = HtmlWriter.GenerateHtml(copiedColoredChunks, docStyle, options);
//					Console.WriteLine ("html:" + html);
                    selection_data.Set(HTML_ATOM, UTF8_FORMAT, Encoding.UTF8.GetBytes(html));
                    break;

                case MonoTextType:
                    byte[] rawText        = Encoding.UTF8.GetBytes(GetCopiedPlainText());
                    var    copyDataLength = (byte)(copyData != null ? copyData.Length : 0);
                    var    dataOffset     = 1 + 1 + copyDataLength;
                    byte[] data           = new byte [rawText.Length + dataOffset];
                    data [1] = copyDataLength;
                    if (copyDataLength > 0)
                    {
                        copyData.CopyTo(data, 2);
                    }
                    rawText.CopyTo(data, dataOffset);
                    data [0] = 0;
                    if (isBlockMode)
                    {
                        data [0] |= 1;
                    }
                    if (isLineSelectionMode)
                    {
                        data [0] |= 2;
                    }
                    selection_data.Set(MD_ATOM, UTF8_FORMAT, data);
                    break;
                }
            }
Esempio n. 5
0
        /// <summary>
        /// Gets the grid field.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        /// <param name="selection">The selection.</param>
        /// <returns></returns>
        public override System.Web.UI.WebControls.DataControlField GetGridField(Type entityType, string selection)
        {
            SelectionData data = DeserializeSelectionData(selection);

            var result = new LavaBoundField();

            result.LavaTemplate = data.Template;
            result.LavaKey      = data.Property;

            /* Legacy options add about 0.3s per column. Disable them. */
            var options = new Rock.Lava.CommonMergeFieldsOptions();

            options.GetLegacyGlobalMergeFields = false;
            result.LavaMergeFields             = Rock.Lava.LavaHelper.GetCommonMergeFields(null, null, options);

            return(result);
        }
Esempio n. 6
0
        public static Photo [] GetPhotosData(this SelectionData selection_data)
        {
            int size   = sizeof(uint);
            int length = selection_data.Length / size;

            PhotoStore photo_store = App.Instance.Database.Photos;

            Photo [] photos = new Photo [length];

            for (int i = 0; i < length; i++)
            {
                uint id = System.BitConverter.ToUInt32(selection_data.Data, i * size);
                photos [i] = photo_store.Get(id);
            }

            return(photos);
        }
Esempio n. 7
0
        public static Tag [] GetTagsData(this SelectionData selection_data)
        {
            int size   = sizeof(uint);
            int length = selection_data.Length / size;

            TagStore tag_store = App.Instance.Database.Tags;

            Tag [] tags = new Tag [length];

            for (int i = 0; i < length; i++)
            {
                uint id = System.BitConverter.ToUInt32(selection_data.Data, i * size);
                tags [i] = tag_store.Get(id);
            }

            return(tags);
        }
Esempio n. 8
0
        internal Batch(string batchText, SelectionData selection, int ordinalId, IFileStreamFactory outputFileFactory)
        {
            // Sanity check for input
            Validate.IsNotNullOrEmptyString(nameof(batchText), batchText);
            Validate.IsNotNull(nameof(outputFileFactory), outputFileFactory);
            Validate.IsGreaterThan(nameof(ordinalId), ordinalId, 0);

            // Initialize the internal state
            BatchText          = batchText;
            Selection          = selection;
            executionStartTime = DateTime.Now;
            HasExecuted        = false;
            Id                     = ordinalId;
            resultSets             = new List <ResultSet>();
            resultMessages         = new List <ResultMessage>();
            this.outputFileFactory = outputFileFactory;
        }
Esempio n. 9
0
            public void SetData(SelectionData selection_data, uint info)
            {
                if (selection_data == null)
                {
                    return;
                }
                switch (info)
                {
                case TextType:
                    // Windows specific hack to work around bug: Bug 661973 - copy operation in TextEditor braks text lines with duplicate line endings when the file has CRLF
                    // Remove when https://bugzilla.gnome.org/show_bug.cgi?id=640439 is fixed.
                    if (Platform.IsWindows)
                    {
                        selection_data.Text = copiedDocument.Text.Replace("\r\n", "\n");
                    }
                    else
                    {
                        selection_data.Text = copiedDocument.Text;
                    }
                    break;

                case RichTextType:
                    selection_data.Set(RTF_ATOM, UTF8_FORMAT, System.Text.Encoding.UTF8.GetBytes(RtfWriter.GenerateRtf(copiedDocument, mode, docStyle, options)));
                    break;

                case HTMLTextType:
                    selection_data.Set(HTML_ATOM, UTF8_FORMAT, System.Text.Encoding.UTF8.GetBytes(HtmlWriter.GenerateHtml(copiedDocument, mode, docStyle, options)));
                    break;

                case MonoTextType:
                    byte[] rawText = System.Text.Encoding.UTF8.GetBytes(monoDocument.Text);
                    byte[] data    = new byte [rawText.Length + 1];
                    rawText.CopyTo(data, 1);
                    data [0] = 0;
                    if (isBlockMode)
                    {
                        data [0] |= 1;
                    }
                    if (isLineSelectionMode)
                    {
                        data [0] |= 2;
                    }
                    selection_data.Set(MD_ATOM, UTF8_FORMAT, data);
                    break;
                }
            }
Esempio n. 10
0
        protected override void OnDragDataGet(Gdk.DragContext context, SelectionData selectionData, uint info, uint time)
        {
            List <IViewModel> draggedViewModels = new List <IViewModel> ();
            var paths = Selection.GetSelectedRows();

            foreach (var path in paths)
            {
                TreeIter iter;
                Model.GetIter(out iter, path);
                var vm = (IViewModel)Model.GetValue(iter, COL_DATA);
                if (vm != null)
                {
                    draggedViewModels.Add(vm);
                }
            }
            App.Current.DragContext.SourceData = draggedViewModels;
        }
Esempio n. 11
0
        internal static SelectionData ToManaged(SelectionData_StructInternal _internal_struct)
        {
            var _external_struct = new SelectionData();

            _external_struct.Pos    = Eina.Position2D_StructConversion.ToManaged(_internal_struct.Pos);
            _external_struct.Format = _internal_struct.Format;

            _external_struct.Content.Len = _internal_struct.Content.Len;
            _external_struct.Content.Mem = _internal_struct.Content.Mem;

            _external_struct.Action = _internal_struct.Action;

            _external_struct.Item = (Efl.Object)System.Activator.CreateInstance(typeof(Efl.Object), new System.Object[] { _internal_struct.Item });
            Efl.Eo.Globals.efl_ref(_internal_struct.Item);


            return(_external_struct);
        }
Esempio n. 12
0
 protected override void OnDragDataGet(Gdk.DragContext context, SelectionData selection_data, uint info, uint time)
 {
     if (info == Banshee.Gui.DragDrop.DragDropTarget.UriList.Info)
     {
         ITrackModelSource track_source = ServiceManager.SourceManager.ActiveSource as ITrackModelSource;
         if (track_source != null)
         {
             System.Text.StringBuilder sb = new System.Text.StringBuilder();
             foreach (TrackInfo track in track_source.TrackModel.SelectedItems)
             {
                 sb.Append(track.Uri);
                 sb.Append("\r\n");
             }
             byte [] data = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
             selection_data.Set(context.Targets[0], 8, data, data.Length);
         }
     }
 }
Esempio n. 13
0
    void WorkerExecute(UnitTask.TaskType t, SelectionData SD)
    {
        bool ShouldSet = !QueueModDown;

        if (t == UnitTask.TaskType.Walk)
        {
            AddTaskToWorker(t, SD._Worker, GetMousePosition(), null, ShouldSet);
            return;
        }
        else if (t == UnitTask.TaskType.ClearRubble)
        {
            if (!AddTaskToWorker(t, SD._Worker, _hit.point, _hit.collider.gameObject, ShouldSet))
            {
                AddTaskToWorker(UnitTask.TaskType.Walk, SD._Worker, GetMousePosition(), null, ShouldSet);
            }
            return;
        }
        AddTaskToWorker(t, SD._Worker, _hit.point, _hit.collider.gameObject, ShouldSet);
    }
Esempio n. 14
0
        public static void SetPhotosData(this SelectionData selection_data, Photo [] photos, Atom target)
        {
            byte [] data = new byte [photos.Length * sizeof(uint)];

            int i = 0;

            foreach (Photo photo in photos)
            {
                byte [] bytes = System.BitConverter.GetBytes(photo.Id);

                foreach (byte b in bytes)
                {
                    data [i] = b;
                    i++;
                }
            }

            selection_data.Set(target, 8, data, data.Length);
        }
Esempio n. 15
0
 void FillSelectionData(SelectionData aData, uint aInfo)
 {
     if (aInfo < (int)TransferDataType.X_Special)
     {
         aData.Set(aData.Target, 8, System.Text.Encoding.UTF8.GetBytes(copyBuffer.ToShortDateString()),
                   System.Text.Encoding.UTF8.GetBytes(copyBuffer.ToShortDateString()).Length);
     }
     else
     {
         byte[] num  = BitConverter.GetBytes(copyBuffer.Year);
         byte[] data = new byte[num.Length * 3];
         num.CopyTo(data, 0);
         num = BitConverter.GetBytes(copyBuffer.Month);
         num.CopyTo(data, num.Length);
         num = BitConverter.GetBytes(copyBuffer.Day);
         num.CopyTo(data, num.Length * 2);
         aData.Set(aData.Target, 8, data, data.Length);
     }
 }
Esempio n. 16
0
        public static void SetTagsData(this SelectionData selection_data, Tag [] tags, Atom target)
        {
            byte [] data = new byte [tags.Length * sizeof(uint)];

            int i = 0;

            foreach (Tag tag in tags)
            {
                byte [] bytes = System.BitConverter.GetBytes(tag.Id);

                foreach (byte b in bytes)
                {
                    data [i] = b;
                    i++;
                }
            }

            selection_data.Set(target, 8, data, data.Length);
        }
Esempio n. 17
0
        /// <summary>
        /// Emitted on the drop site. If the data was recieved to preview the data, call
        /// Gdk.Drag.Status (), else call Gdk.Drag.Finish ()
        /// RetVal = true on success
        /// </summary>
        void HandleDragDataReceived(object o, DragDataReceivedArgs args)
        {
            if (drag_data_requested)
            {
                SelectionData data = args.SelectionData;

                string uris = Encoding.UTF8.GetString(data.Data);

                drag_data = Regex.Split(uris, "\r\n")
                            .Where(uri => uri.StartsWith("file://"));

                drag_data_requested  = false;
                drag_is_desktop_file = drag_data.Any(d => d.EndsWith(".desktop"));
                Owner.SetHoveredAcceptsDrop();
            }

            Gdk.Drag.Status(args.Context, DragAction.Copy, Gtk.Global.CurrentEventTime);
            args.RetVal = true;
        }
Esempio n. 18
0
    public void SetSelected(CandidateAgentData candidate)
    {
        if (currentSelection == null)
        {
            currentSelection = new SelectionData();
        }
        currentSelection.candidate = candidate;

        // Check if corresponding agent exists:
        bool hasAgent = false;

        foreach (var agent in simulation.agents)
        {
            if (currentSelection.candidate.candidateID != agent.candidateRef.candidateID)
            {
                continue;
            }

            hasAgent = true;
            currentSelection.agent = agent;
            theRenderKing.InitializeCreaturePortrait(currentSelection.candidate.candidateGenome);
            uiManager.genomeViewerUI.brainGenomeImage.SetTexture(currentSelection.candidate.candidateGenome.brainGenome);

            CameraManager.instance.targetAgent          = agent;
            CameraManager.instance.targetAgentTransform = agent.bodyGO.transform;
            CameraManager.instance.targetAgentIndex     = agent.index;
            break;
        }

        currentSelection.isGenomeOnly             = !hasAgent;
        currentSelection.historySelectedSpeciesID = currentSelection.candidate.speciesID;
        //SetHistorySelectedSpeciesUI(candidate.speciesID);
        uiManager.historyPanelUI.InitializePanel();
        //uiManager.historyPanelUI.RefreshFocusedAgent(currentSelection.agent);
        uiManager.speciesOverviewUI.RebuildGenomeButtons();

        if (hasAgent)
        {
            unlockedTech = currentSelection.candidate.candidateGenome.bodyGenome.unlockedTech;
            //PrintTech();
        }
    }
Esempio n. 19
0
    void SelectObject(GameObject GO, SelectObjectFilter Filter = SelectObjectFilter.All, bool final = false)
    {
        SelectionData SD = new SelectionData();

        SD._Object = GO.GetComponent <SelectableObject>();
        if (!SD.IsValid())
        {
            SD._Object = GO.GetComponentInParent <SelectableObject>();
            if (!SD.IsValid())
            {
                return;
            }
        }
        SD._Worker  = GO.GetComponent <Worker>();
        SD._Vehicle = GO.GetComponent <Vehicle>();
        if (Filter == SelectObjectFilter.Workers)
        {
            if (!SD.IsWorker() && !SD.IsVehicle())
            {
                return;
            }
        }
        SD._Building = GO.GetComponentInParent <Building>();
        SD._Rock     = GO.GetComponentInParent <RockScript>();
        if (SD.ShouldBeCulled())
        {
            if (!CPU_FOW.Get().MultiSampleFOW(GO.transform.position, MSSampleDistance))
            {
                return;
            }
        }
        SD._Object.SetSelectionState(true);
        if (final && SD.IsWorker() && ShouldPlaySound())
        {
            SD._Worker.PlaySelectionSound();
        }
        if (final && SD.IsVehicle() && ShouldPlaySound())
        {
            SD._Vehicle.PlaySelectionSound();
        }
        CurrentSelectionObjects.Add(SD);
    }
Esempio n. 20
0
        public override bool CanDropNode(object dataObject, DragOperation operation)
        {
            string targetDirectory = GetFolderPath(CurrentNode.DataItem);

            if (dataObject is SolutionFolderFileNode)
            {
                return(true);
            }
            else if (dataObject is ProjectFile)
            {
                ProjectFile file   = (ProjectFile)dataObject;
                var         srcDir = (file.Project != null && file.IsLink)
                                        ? file.Project.BaseDirectory.Combine(file.ProjectVirtualPath)
                                        : file.FilePath.ParentDirectory;

                switch (operation)
                {
                case DragOperation.Move:
                    // allow grouped files to be unlinked from their parent
                    return(srcDir != targetDirectory || file.DependsOnFile != null);

                case DragOperation.Copy:
                    return(true);

                default:
                    return(false);
                }
            }
            else if (dataObject is ProjectFolder)
            {
                return(((ProjectFolder)dataObject).Path != targetDirectory || operation == DragOperation.Copy);
            }
            else if (dataObject is Gtk.SelectionData)
            {
                SelectionData data = (SelectionData)dataObject;
                if (data.Type == "text/uri-list")
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 21
0
        /// <summary>
        /// Sets the selection.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <param name="selection">The selection.</param>
        public override void SetSelection(System.Web.UI.Control[] controls, string selection)
        {
            if (controls.Count() == 3)
            {
                RockDropDownList ddlProperty     = controls[0] as RockDropDownList;
                RockDropDownList ddlSortProperty = controls[1] as RockDropDownList;
                CodeEditor       codeEditor      = controls[2] as CodeEditor;

                if (codeEditor != null && ddlProperty != null && ddlSortProperty != null)
                {
                    SelectionData data = DeserializeSelectionData(selection);

                    codeEditor.Text           = data.Template ?? string.Empty;
                    ddlProperty.SelectedValue = data.Property ?? string.Empty;

                    PopulateSortProperties(ddlProperty.SelectedValue, ddlSortProperty);
                    ddlSortProperty.SelectedValue = data.SortProperty;
                }
            }
        }
Esempio n. 22
0
        internal Batch(string batchText, SelectionData selection, int ordinalId,
                       IFileStreamFactory outputFileFactory, int executionCount = 1, bool getFullColumnSchema = false)
        {
            // Sanity check for input
            Validate.IsNotNullOrEmptyString(nameof(batchText), batchText);
            Validate.IsNotNull(nameof(outputFileFactory), outputFileFactory);
            Validate.IsGreaterThan(nameof(ordinalId), ordinalId, 0);

            // Initialize the internal state
            BatchText          = batchText;
            Selection          = selection;
            executionStartTime = DateTime.Now;
            HasExecuted        = false;
            Id                     = ordinalId;
            resultSets             = new List <ResultSet>();
            this.outputFileFactory = outputFileFactory;
            specialAction          = new SpecialAction();
            BatchExecutionCount    = executionCount > 0 ? executionCount : 1;

            this.getFullColumnSchema = getFullColumnSchema;
        }
Esempio n. 23
0
 void FillSelectionData(SelectionData aData, uint aInfo)
 {
     if (aInfo < (int)TransferDataType.X_Special)
     {
         aData.Set(aData.Target, 8, System.Text.Encoding.UTF8.GetBytes(GetTimeAsString(copyBuffer)),
                   System.Text.Encoding.UTF8.GetBytes(GetTimeAsString(copyBuffer)).Length);
     }
     else
     {
         byte[] num  = BitConverter.GetBytes(copyBuffer.Hour);
         byte[] data = new byte[num.Length * 4];
         num.CopyTo(data, 0);
         num = BitConverter.GetBytes(copyBuffer.Minute);
         num.CopyTo(data, num.Length);
         num = BitConverter.GetBytes(copyBuffer.Second);
         num.CopyTo(data, num.Length * 2);
         num = BitConverter.GetBytes(copyBuffer.Millisecond);
         num.CopyTo(data, num.Length * 3);
         aData.Set(aData.Target, 8, data, data.Length);
     }
 }
Esempio n. 24
0
        /// <summary>
        /// Called when a selection changes. The snap-in should override this method to read the updated <see cref="P:Microsoft.ManagementConsole.MmcListView.SelectedNodes"></see> property and update <see cref="T:Microsoft.ManagementConsole.SelectionData"></see> class accordingly.
        /// </summary>
        /// <param name="status">The object that holds the status information.</param>
        protected override void OnSelectionChanged(SyncStatus status)
        {
            if (this.SelectedNodes.Count == 0)
            {
                // No items are selected; clear selection data and associated actions.
                SelectionData.Clear();
                SelectionData.ActionsPaneItems.Clear();
            }
            else
            {
                //    WritableSharedData writableSharedData = new WritableSharedData();

                //    WritableSharedDataItem writableSharedDataItem = new WritableSharedDataItem(DataFormats.UnicodeText, true);
                //    writableSharedDataItem.SetData(Encoding.Unicode.GetBytes("asdasdas asd adasd asdas das d"));
                //    writableSharedData.Add(writableSharedDataItem);

                //    WritableSharedDataItem writableSharedDataItem2 = new WritableSharedDataItem(DataFormats.Text, true);
                //    writableSharedDataItem2.SetData(Encoding.ASCII.GetBytes("asdasdas asd adasd asdas das d"));
                //    writableSharedData.Add(writableSharedDataItem2);

                //WritableSharedDataItem writableSharedDataItem3 = new WritableSharedDataItem(DataFormats.Html, false);
                //writableSharedDataItem3.SetData(Encoding.ASCII.GetBytes("asdasdas asd adasd asdas das d"));
                //writableSharedData.Add(writableSharedDataItem3);

                StringBuilder selectedItems = new StringBuilder();

                foreach (ResultNode node in this.SelectedNodes)
                {
                    selectedItems.Append(node.DisplayName);
                    selectedItems.Append(" ");
                    selectedItems.Append(string.Join(" ", node.SubItemDisplayNames.ToArray()));
                    selectedItems.AppendLine();
                }

                SelectionData.Update(selectedItems.ToString(), this.SelectedNodes.Count > 1, null, null);

                SelectionData.ActionsPaneItems.Clear();
                SelectionData.ActionsPaneItems.Add(this.CopyToClipboardAction);
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Gets the selection.
        /// </summary>
        /// <param name="controls">The controls.</param>
        /// <returns></returns>
        public override string GetSelection(System.Web.UI.Control[] controls)
        {
            if (controls.Count() == 3)
            {
                RockDropDownList ddlProperty     = controls[0] as RockDropDownList;
                RockDropDownList ddlSortProperty = controls[1] as RockDropDownList;
                CodeEditor       codeEditor      = controls[2] as CodeEditor;

                if (codeEditor != null && ddlProperty != null)
                {
                    SelectionData data = new SelectionData();

                    data.Template     = codeEditor.Text;
                    data.Property     = ddlProperty.SelectedValue;
                    data.SortProperty = ddlSortProperty.SelectedValue;

                    return(JsonConvert.SerializeObject(data));
                }
            }

            return(string.Empty);
        }
Esempio n. 26
0
        const int Version1          = 1;                                           //旧ファイルバージョン1

        //バイナリ読み込み
        void ReadBinary(BinaryReader reader)
        {
            int magicID = reader.ReadInt32();

            if (magicID != MagicID)
            {
                throw new System.Exception("Read File Id Error");
            }

            int fileVersion = reader.ReadInt32();

            if (fileVersion == Version)
            {
                ReadData.Read(reader);
                SelectionData.Read(reader);
                Engine.Config.Read(reader);
                GalleryData.Read(reader);
                Engine.Param.ReadSystemData(reader);
            }
            else if (fileVersion == Version2)
            {
                ReadData.Read(reader);
                Engine.Config.Read(reader);
                GalleryData.Read(reader);
                Engine.Param.ReadSystemData(reader);
            }
            else if (fileVersion == Version1)
            {
                ReadData.Read(reader);
                Engine.Config.Read(reader);
                GalleryData.Read(reader);
            }
            else
            {
                throw new System.Exception(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, fileVersion));
            }
        }
Esempio n. 27
0
        public async Task QueryExecuteMissingSelectionTest(SelectionData selection)
        {
            // Set up file for returning the query
            var fileMock = new Mock <ScriptFile>();

            fileMock.SetupGet(file => file.Contents).Returns("");
            // Set up workspace mock
            var workspaceService = new Mock <WorkspaceService <SqlToolsSettings> >();

            workspaceService.Setup(service => service.Workspace.GetFile(It.IsAny <string>()))
            .Returns(fileMock.Object);
            // If:
            // ... I request to execute a query with a missing query string
            var queryService = await Common.GetPrimedExecutionService(Common.CreateMockFactory(null, false), true, workspaceService.Object);

            var queryParams = new QueryExecuteParams {
                OwnerUri = Common.OwnerUri, QuerySelection = selection
            };

            object errorResult    = null;
            var    requestContext = RequestContextMocks.Create <QueryExecuteResult>(null)
                                    .AddErrorHandling(error => errorResult = error);
            await queryService.HandleExecuteRequest(queryParams, requestContext.Object);

            // Then:
            // ... Am error should have been sent
            // ... No result should have been sent
            // ... No completion event should have been fired
            // ... An active query should not have been added
            VerifyQueryExecuteCallCount(requestContext, Times.Never(), Times.Never(), Times.Once());
            Assert.NotNull(errorResult);
            Assert.IsType <string>(errorResult);
            Assert.DoesNotContain(Common.OwnerUri, queryService.ActiveQueries.Keys);

            // ... There should not be an active query
            Assert.Empty(queryService.ActiveQueries);
        }
Esempio n. 28
0
        //<summary>Called when an application wants to get our clipboard data</summary>
        private void OnClipboardGet(Clipboard cb, SelectionData sd, uint n)
        {
            // if application accepts text
            if (sd.Target.Name == "UTF8_STRING")
            {
                switch (this.FocusedArea.Type)
                {
                case "hexadecimal":
                    sd.Text = ByteArray.ToString(clipdata, 16);
                    break;

                case "decimal":
                    sd.Text = ByteArray.ToString(clipdata, 10);
                    break;

                case "octal":
                    sd.Text = ByteArray.ToString(clipdata, 8);
                    break;

                case "binary":
                    sd.Text = ByteArray.ToString(clipdata, 2);
                    break;

                case "ascii":
                    sd.Set(sd.Target, 8, clipdata);
                    break;

                default:
                    break;
                }
            }     // if application accepts raw bytes
            else if (sd.Target.Name == "application/octet-stream")
            {
                sd.Set(sd.Target, 8, clipdata);
            }
        }
Esempio n. 29
0
        /// <summary>
        ///     Allows you to populate the current wish list item object using a WishListItemDTO instance
        /// </summary>
        /// <param name="dto">An instance of the wish list item from the REST API</param>
        public void FromDto(WishListItemDTO dto)
        {
            if (dto == null)
            {
                return;
            }

            Id             = dto.Id;
            StoreId        = dto.StoreId;
            CustomerId     = dto.CustomerId;
            LastUpdatedUtc = dto.LastUpdatedUtc;
            ProductId      = dto.ProductId ?? string.Empty;
            Quantity       = dto.Quantity;
            SelectionData.Clear();
            if (dto.SelectionData != null)
            {
                foreach (var op in dto.SelectionData)
                {
                    var o = new OptionSelection();
                    o.FromDto(op);
                    SelectionData.OptionSelectionList.Add(o);
                }
            }
        }
 /// <summary>
 /// OnDataSelectionChanged method implementation
 /// </summary>
 private void OnDataSelectionChanged(object sender, SelectionDataEventArgs e)
 {
     if (e.Action != MMCListAction.SelectionChanged)
     {
         return;
     }
     this.SelectionData.BeginUpdates();
     try
     {
         if (e.Selection.Count == 0)
         {
             this.SelectionData.Clear();
         }
         else
         {
             if (e.Selection.Count > 0)
             {
                 SelectionData.Update(e.Selection, e.Selection.Count > 1, null, null);
                 if (e.Selection.Count == 1)
                 {
                     UpdateActionPanelItems(e.Selection);
                     SelectionData.DisplayName = e.Selection[0].UPN;
                 }
                 else
                 {
                     UpdateActionPanelItems(e.Selection);
                     SelectionData.DisplayName = res.USERSFRMSLECTMULTIPLE;
                 }
             }
         }
     }
     finally
     {
         this.SelectionData.EndUpdates();
     }
 }
Esempio n. 31
0
 public void HandleSelectionData(SelectionData sd, Gdk.DragAction action, string targetPath)
 {
     string type = sd.Type.Name;
     if (type == "application/x-color") {
       /** DESCTRUCTIVE */
       Helpers.LogError ("Would set {0} color to {1}", targetPath, BitConverter.ToString(sd.Data));
     } else if (type == "text/uri-list" || ((type == "text/plain" || type == "STRING") && Helpers.IsURI(sd.Text))) {
       /** DESCTRUCTIVE */
       string data = Helpers.BytesToASCII(sd.Data);
       string[] uris = data.Split(new char[] {'\r','\n','\0'}, StringSplitOptions.RemoveEmptyEntries);
       if (action == Gdk.DragAction.Move) {
     moveUris(uris, targetPath);
       } else if (action == Gdk.DragAction.Copy) {
     copyUris(uris, targetPath);
       } else if (action == Gdk.DragAction.Ask) {
     DragURIMenu(uris, targetPath);
       }
     } else {
       /** DESCTRUCTIVE */
       if (Helpers.IsDir(targetPath)) {
     DragDataToCreateFileMenu(targetPath, sd.Data);
       } else {
     DragDataToFileMenu(targetPath, sd.Data);
       }
     }
 }
Esempio n. 32
0
    private void parseData()
    {
        string[] itemRowsList = ResourceManager.LoadText("main.text");
        text.Clear();

        //Skip first three lines.
        for (int i = 3; i < itemRowsList.Length; ++i)
        {
            string[] itemColumnsList = itemRowsList[i].Split('\t');
            if (itemColumnsList.Length < 3)
            {
                Debug.LogWarning("The source data seems to have an inconsistent number of columns: " + itemColumnsList.Length);
                continue;
            }

            StoryData data = new StoryData(itemColumnsList);
            text.Add(data.id, data);

        }

        itemRowsList = ResourceManager.LoadText("main.selection");
        selection.Clear();

        //Skip first three lines.
        for (int i = 3; i < itemRowsList.Length; ++i)
        {
            string[] itemColumnsList = itemRowsList[i].Split('\t');
            if (itemColumnsList.Length < 3)
            {
                Debug.LogWarning("The source data seems to have an inconsistent number of columns: " + itemColumnsList.Length);
                continue;
            }

            SelectionData data = new SelectionData(itemColumnsList);
            selection.Add(data.id, data);

        }

        itemRowsList = ResourceManager.LoadText("main.condition");
        condition.Clear();

        //Skip first three lines.
        for (int i = 3; i < itemRowsList.Length; ++i)
        {
            string[] itemColumnsList = itemRowsList[i].Split('\t');
            if (itemColumnsList.Length < 3)
            {
                Debug.LogWarning("The source data seems to have an inconsistent number of columns: " + itemColumnsList.Length);
                continue;
            }

            ConditionData data = new ConditionData(itemColumnsList);
            condition.Add(data.id, data);

        }
    }
		protected void HandleDataReceived (uint aType, Gtk.Widget aSource, SelectionData aData)
		{
			if (Editable == false)
				return;
			ResetEditing();
			string text = "";
			switch (aType) {
			case (int) TransferDataType.Default:
				text = System.Text.Encoding.UTF8.GetString (aData.Data);
				break;
			case (int) TransferDataType.X_Special:
				int intsize = (BitConverter.GetBytes((int) 1).Length);
				int y = BitConverter.ToInt32 (aData.Data, 0);
				int m = BitConverter.ToInt32 (aData.Data, intsize);
				int d = BitConverter.ToInt32 (aData.Data, intsize * 2);
				day = d;
				SetCorrectDateTime (y, m, d);
				return;
			}		
			if (text != "")
				try {
					DateTime dt = DateTime.Parse (text);
					day = dt.Day;
					SetCorrectDateTime (dt.Year, dt.Month, dt.Day);
				}
				catch {}
			text = "";
		}
		void FillSelectionData (SelectionData aData, uint aInfo) 
		{
			if (aInfo < (int) TransferDataType.X_Special)
				aData.Set (aData.Target, 8, System.Text.Encoding.UTF8.GetBytes (copyBuffer.ToShortDateString()),
				           System.Text.Encoding.UTF8.GetBytes (copyBuffer.ToShortDateString()).Length);
			else {
				byte[] num = BitConverter.GetBytes (copyBuffer.Year);
				byte[] data = new byte[num.Length*3];
				num.CopyTo (data, 0);
				num = BitConverter.GetBytes (copyBuffer.Month);
				num.CopyTo (data, num.Length);
				num = BitConverter.GetBytes (copyBuffer.Day);
				num.CopyTo (data, num.Length*2);
				aData.Set (aData.Target, 8, data, data.Length);
			}
		}
Esempio n. 35
0
 public static void PrintSelectionData(SelectionData sd)
 {
     LogError ();
     LogError("Selection: {0}", sd.Selection.Name);
     LogError("Target: {0}", sd.Target.Name);
     string[] targets = new string[sd.Targets.Length];
     for (int i=0; i<targets.Length; i++) targets[i] = sd.Targets[i].Name;
     LogError("Targets: {0}", String.Join(", ", targets));
     LogError("Format: {0}", sd.Format);
     LogError("Length: {0}", sd.Length);
     if (sd.Length < 0) return;
     LogError("Data: {0}", BitConverter.ToString(sd.Data));
     LogError("Pixbuf: {0}", sd.Pixbuf);
     LogError("Text: {0}", sd.Text);
     LogError("Type: {0}", sd.Type.Name);
     LogError("Uris: {0}", sd.Uris);
 }
 public void EqualityShouldWork()
 {
     var d1 = new SelectionData(new[] { new SelectionData.ObjectId(new byte[] { 1, 2, 3 }) }, 5);
     var d2 = new SelectionData(new[] { new SelectionData.ObjectId(new byte[] { 1, 2, 3 }) }, 5);
     d1.Equals(d2).Should().BeTrue();
 }