private void LoadSettings()
 {
   this.DisplayOptions = XMLUTILS.LoadDisplayOptionsSettings();
   this.SetVolume();
   this.SetProgress();
   this.SetDiskIcon();
 }
Beispiel #2
0
        /// <summary>
        /// Write out the target link information
        /// </summary>
        /// <param name="target">The target for which to write link information</param>
        /// <param name="options">The link display options</param>
        /// <param name="writer">The write to which the information is written</param>
        public void WriteTarget(Target target, DisplayOptions options, XmlWriter writer)
        {
            if(target == null)
                throw new ArgumentNullException("target");

            if(writer == null)
                throw new ArgumentNullException("writer");

            NamespaceTarget space = target as NamespaceTarget;

            if(space != null)
            {
                WriteNamespaceTarget(space, writer);
                return;
            }

            TypeTarget type = target as TypeTarget;

            if(type != null)
            {
                WriteTypeTarget(type, options, writer);
                return;
            }

            MemberTarget member = target as MemberTarget;

            if(member != null)
            {
                WriteMemberTarget(member, options, writer);
                return;
            }

            if(target.Id.StartsWith("R:", StringComparison.OrdinalIgnoreCase))
            {
                WriteInvalid(new InvalidReference(target.Id), writer);
                return;
            }

            throw new InvalidOperationException("Unknown target type");
        }
Beispiel #3
0
        private void WriteConstructor(ConstructorTarget constructor, DisplayOptions options, XmlWriter writer)
        {
            WriteType(constructor.ContainingType, options & ~DisplayOptions.ShowContainer, writer);

            if((options & DisplayOptions.ShowParameters) > 0)
                WriteMethodParameters(constructor.Parameters, writer);
        }
Beispiel #4
0
        /// <summary>
        /// Write out a type target
        /// </summary>
        /// <param name="type">The type target information</param>
        /// <param name="options">The link display options</param>
        /// <param name="showOuterType">True to show the outer type, false if not</param>
        /// <param name="writer">The write to which the information is written</param>
        private void WriteTypeTarget(TypeTarget type, DisplayOptions options, bool showOuterType, XmlWriter writer)
        {

            // write namespace, if containers are requested
            if((options & DisplayOptions.ShowContainer) > 0)
            {
                WriteNamespace(type.ContainingNamespace, writer);
                WriteSeparator(writer);
            }

            // write outer type, if one exists
            if(showOuterType && (type.ContainingType != null))
            {
                WriteSimpleType(type.ContainingType, DisplayOptions.Default, writer);
                WriteSeparator(writer);
            }

            // write the type name
            writer.WriteString(type.Name);

            // write if template parameters, if they exist and we are requested
            if((options & DisplayOptions.ShowTemplates) > 0)
            {
                WriteTemplateParameters(type.Templates, writer);
            }
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the SimpleRootSiteDataProviderVc class
		/// </summary>
		/// <param name="options"></param>
		/// ------------------------------------------------------------------------------------
		public SimpleRootSiteDataProviderVc(DisplayOptions options)
		{
			m_displayOptions = options;
		}
            public string GetDisplayString(DisplayOptions option)
            {
                switch (option)
                {
                case DisplayOptions.Message:
                    if (!object.ReferenceEquals(this.lastUpdatedMessage, this.ValidationResult.Message))
                    {
                        this.displayMessage     = this.ValidationResult.Message.Replace("\n", " ").Replace("\r", "");
                        this.lastUpdatedMessage = this.ValidationResult.Message;
                    }

                    return(this.displayMessage);

                case DisplayOptions.Path:
                {
                    var path = this.ProfileResult.Path;

                    if (string.IsNullOrEmpty(path) && this.ProfileResult.Source is UnityEngine.Object)
                    {
                        var uObj = this.ProfileResult.Source as UnityEngine.Object;
                        if (AssetDatabase.Contains(uObj.GetInstanceID()))
                        {
                            path = AssetDatabase.GetAssetPath(uObj.GetInstanceID());
                        }
                    }

                    return(path);
                }

                case DisplayOptions.PropertyPath:
                {
                    return(this.ValidationResult.Path);
                }

                case DisplayOptions.Validator:
                    return(this.ValidationResult.Setup.Validator == null ? "None" : this.ValidationResult.Setup.Validator.GetType().GetNiceName());

                case DisplayOptions.Object:
                    return(this.ProfileResult.Name);

                case DisplayOptions.Scene:
                    return(this.SceneName);

                case DisplayOptions.Category:
                    switch (this.ValidationResult.ResultType)
                    {
                    case ValidationResultType.Error:
                        return("Error");

                    case ValidationResultType.Warning:
                        return("Warning");

                    case ValidationResultType.Valid:
                    case ValidationResultType.IgnoreResult:
                    default:
                        return("");
                    }

                default:
                    return("");
                }
            }
Beispiel #7
0
        internal static void WriteSimpleMemberReference(SimpleMemberReference member, DisplayOptions options, XmlWriter writer, LinkTextResolver resolver)
        {
            string cer = member.Id;

            string typeCer, memberName, arguments;

            DecomposeMemberIdentifier(cer, out typeCer, out memberName, out arguments);

            if ((options & DisplayOptions.ShowContainer) > 0)
            {
                SimpleTypeReference type = CreateSimpleTypeReference(typeCer);
                WriteSimpleTypeReference(type, options & ~DisplayOptions.ShowContainer, writer);
                writer.WriteString(".");
            }

            // Change this so that we deal with EII names correctly, too
            writer.WriteString(memberName);

            if ((options & DisplayOptions.ShowParameters) > 0)
            {
                if (String.IsNullOrEmpty(arguments))
                {
                    Parameter[] parameters = new Parameter[0];
                    resolver.WriteMethodParameters(parameters, writer);
                }
                else
                {
                    IList <string> parameterTypeCers = SeparateTypes(arguments);
                    Parameter[]    parameters        = new Parameter[parameterTypeCers.Count];

                    for (int i = 0; i < parameterTypeCers.Count; i++)
                    {
                        TypeReference parameterType = CreateTypeReference(parameterTypeCers[i]);

                        if (parameterType == null)
                        {
                            parameterType = new NamedTemplateTypeReference("UAT");
                        }

                        parameters[i] = new Parameter(String.Empty, parameterType);
                    }

                    resolver.WriteMethodParameters(parameters, writer);
                }
            }
        }
Beispiel #8
0
 private void WriteSimpleMember(SimpleMemberReference member, DisplayOptions options, XmlWriter writer)
 {
     WriteSimpleMember(member, options, writer, null);
 }
 public DisplayOptionsViewModel(DisplayOptions displayOptions)
     : this()
 {
     DisplayOptions = displayOptions;
 }
Beispiel #10
0
 /// <summary>
 /// Write out a simple type reference
 /// </summary>
 /// <param name="simple">The simple type reference information</param>
 /// <param name="options">The link display options</param>
 /// <param name="writer">The write to which the information is written</param>
 public void WriteSimpleType(SimpleTypeReference simple, DisplayOptions options, XmlWriter writer)
 {
     WriteSimpleType(simple, options, true, writer);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RootSiteDataProvider_MultiStringViewVc"/> class.
 /// </summary>
 /// <param name="sda"></param>
 /// <param name="options">The options.</param>
 /// <param name="wsOrder">a list of writing systems in the order the strings should show in the view</param>
 public RootSiteDataProvider_MultiStringViewVc(ISilDataAccess sda, DisplayOptions options, IList <int> wsOrder)
     : base(options, wsOrder)
 {
 }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the SimpleRootSiteDataProviderVc class
 /// </summary>
 /// <param name="options"></param>
 /// <param name="sda"></param>
 /// ------------------------------------------------------------------------------------
 public RootSiteDataProviderVc(DisplayOptions options, ISilDataAccess sda)
     : base(options)
 {
     // DataAccess = sda;
 }
Beispiel #13
0
        public void Start()
        {
            do
            {
                Console.WriteLine("\tEDIT CATEGORY\n");

                Console.WriteLine("(1) Display all Categories");
                Console.WriteLine("(2) Display a specific Category and its related Products");
                Console.WriteLine("(3) Search for a specific category to edit (By the Category Name)");
                Console.WriteLine("(4) Search for a specific category to edit (By the Category ID)");
                Console.WriteLine("(5) Search for a specific category to edit (By the Category Description)");

                Console.WriteLine("Press ESC to go back");

                ConsoleKeyInfo keypress = Console.ReadKey();
                Console.WriteLine();

                NLogger        logging = new NLogger();
                DisplayOptions disOp   = new DisplayOptions();

                //Display all categories
                if (keypress.Key == ConsoleKey.D1 || keypress.Key == ConsoleKey.NumPad1)
                {
                    disOp.DisplayAllCategories();
                }

                //Display specific category and products
                else if (keypress.Key == ConsoleKey.D2 || keypress.Key == ConsoleKey.NumPad2)
                {
                    NorthwindContext db = new NorthwindContext();
                    Console.WriteLine("Which category are you looking for (Name)?");

                    var results = db.SearchCategory(Console.ReadLine(), true);



                    if (results.Count() == 0)
                    {
                        logging.Log("WARN", "No results found. Try Again.");
                    }
                    else
                    {
                        disOp.DisplayCategoryAndProducts(results.FirstOrDefault());
                    }
                }

                //Edit by Name
                else if (keypress.Key == ConsoleKey.D3 || keypress.Key == ConsoleKey.NumPad3)
                {
                    NorthwindContext db = new NorthwindContext();
                    Console.WriteLine("What is the name of the category that you are looking for?");
                    string toFind = Console.ReadLine();


                    var results = db.SearchCategory(toFind, true);

                    if (results.Count() == 0)
                    {
                        //logging.Log("WARN", "No results found. Try Again.");
                    }
                    else if (results.Count() == 1)
                    {
                        disOp.DisplayCategories(results);

                        Console.WriteLine("Is this the correct Product?");
                        Console.WriteLine("If yes, Press Y. If No, Press N.");

                        do
                        {
                            ConsoleKeyInfo keypress2 = Console.ReadKey();
                            Console.WriteLine();

                            if (keypress2.Key == ConsoleKey.Y)
                            {
                                EditCategory(results[0]);
                                break;
                            }
                            else if (keypress2.Key == ConsoleKey.N)
                            {
                                break;
                            }
                            else
                            {
                                logging.Log("ERROR", "A valid key was not pressed. Please press (Y)es or (N)o.");
                            }
                        } while (true);
                    }
                    else
                    {
                        int row = 0;

                        foreach (var category in results)
                        {
                            Console.WriteLine("Row: {0}", row++);
                            disOp.DisplayCategory(category);
                            Console.WriteLine("");
                        }


                        Console.WriteLine("Which Category would you like to edit?");
                        Console.Write("Enter the Row number: \t");

                        string choice = Console.ReadLine();
                        int    vInput = IntValidation(choice);


                        EditCategory(results[vInput - 1]);
                    }
                }

                //Edit by ID
                else if (keypress.Key == ConsoleKey.D4 || keypress.Key == ConsoleKey.NumPad4)
                {
                    NorthwindContext db = new NorthwindContext();
                    Console.WriteLine("What is the ID of the category that you are looking for?");
                    int toFind = IntValidation(Console.ReadLine());


                    var results = db.SearchCategory(toFind);

                    if (results.Count() == 0)
                    {
                    }
                    else if (results.Count() == 1)
                    {
                        disOp.DisplayCategories(results);

                        Console.WriteLine("Is this the correct Product?");
                        Console.WriteLine("If yes, Press Y. If No, Press N.");

                        do
                        {
                            ConsoleKeyInfo keypress2 = Console.ReadKey();
                            Console.WriteLine();

                            if (keypress2.Key == ConsoleKey.Y)
                            {
                                EditCategory(results[0]);
                                break;
                            }
                            else if (keypress2.Key == ConsoleKey.N)
                            {
                                break;
                            }
                            else
                            {
                                logging.Log("ERROR", "A valid key was not pressed. Please press (Y)es or (N)o.");
                            }
                        } while (true);
                    }
                    //Should never get used because ID is unique. If it does, something is terribly wrong with the database.
                    else
                    {
                        int row = 0;

                        foreach (var category in results)
                        {
                            Console.WriteLine("Row: {0}", row++);
                            disOp.DisplayCategory(category);
                            Console.WriteLine("");
                        }


                        Console.WriteLine("Which Category would you like to edit?");
                        Console.Write("Enter the Row number: \t");

                        string choice = Console.ReadLine();
                        int    vInput = IntValidation(choice);


                        EditCategory(results[vInput - 1]);
                    }
                }

                //Edit by description
                else if (keypress.Key == ConsoleKey.D5 || keypress.Key == ConsoleKey.NumPad5)
                {
                    NorthwindContext db = new NorthwindContext();
                    Console.WriteLine("What is the Description of the category that you are looking for?");
                    string toFind = Console.ReadLine();



                    var results = db.SearchCategory(toFind, false);

                    if (results.Count() == 0)
                    {
                        //logging.Log("WARN", "No results found. Try Again.");
                    }
                    else if (results.Count() == 1)
                    {
                        disOp.DisplayCategories(results);

                        Console.WriteLine("Is this the correct Product?");
                        Console.WriteLine("If yes, Press Y. If No, Press N.");

                        do
                        {
                            ConsoleKeyInfo keypress2 = Console.ReadKey();
                            Console.WriteLine();

                            if (keypress2.Key == ConsoleKey.Y)
                            {
                                EditCategory(results[0]);
                                break;
                            }
                            else if (keypress2.Key == ConsoleKey.N)
                            {
                                break;
                            }
                            else
                            {
                                logging.Log("ERROR", "A valid key was not pressed. Please press (Y)es or (N)o.");
                            }
                        } while (true);
                    }
                    //Should never get used because ID is unique. If it does, something is terribly wrong with the database.
                    else
                    {
                        int row = 0;

                        foreach (var category in results)
                        {
                            Console.WriteLine("Row: {0}", row++);
                            disOp.DisplayCategory(category);
                            Console.WriteLine("");
                        }


                        Console.WriteLine("Which Category would you like to edit?");
                        Console.Write("Enter the Row number: \t");

                        string choice = Console.ReadLine();
                        int    vInput = IntValidation(choice);


                        EditCategory(results[vInput - 1]);
                    }
                }
                else if (keypress.Key == ConsoleKey.Escape)
                {
                    break;
                }
                else
                {
                    logging.Log("WARN", "Please press a valid option. Try again.");
                }
            } while (true);
        }
    /// <summary>
    /// Main segmentation loop. Loops through the entire set of pixels to
    /// detect skin-like pixels. Then Removes noise and enhances the skin
    /// pixels using skinblobs and gets the contourPointss of the skin. Finally
    /// calculating the convex hull.
    /// Also changes colors of pixels in the texture for debug / visualisation
    /// purposes.
    /// </summary>
    /// <param name="texture"> Contains all the pixels of the image. </param>
    /// <param name="threshold">
    /// Contains the color threshold to be considered a skin candidate.
    /// </param>
    /// <returns> Edited texture. </returns>
    public Color[] SegmentColors(WebCamTexture texture, float threshold, DisplayOptions OPTIONS)
    {
        // Get an array of pixels from the texture.
        var pixels = texture.GetPixels();

        // First Loop : Segment and identify skin blobs.
        skinObjects       = new List <SkinBlob>();
        largestSkinObject = new SkinBlob(new Vector2());
        int close = 0;

        for (var i = 0; i < pixels.Length; i++)
        {
            // Identify skin coloured pixels and add them to an object.
            // Threshold for skin color lowers if the pixel is close to a definite skin pixel.
            if (PixelThreshold(pixels[i], threshold) || (close > 0 && PixelThreshold(pixels[i], threshold / 2)))
            {
                CheckSkinObjects(Utility.IndexToPoint(texture.width, i));
                close = closeThreshold;
                // Display options - Sets initital segmentation pixels to white
                if (OPTIONS.SHOW_SEGMENTATION_FIRST)
                {
                    pixels[i] = Color.white;
                }
            }
            else
            {
                close--;
                // Display options - Sets other pixels to black
                if (OPTIONS.SHOW_SEGMENTATION_FIRST)
                {
                    pixels[i] = Color.black;
                }
            }
        }

        // Second Loop : focus on largest skin blob, removing noise. Get contour list.

        // Contour list creates candidates for the convex hull.
        var contourPoints = new List <Vector2>();
        // Linewidth dictates the longest uninterrupted line of skin pixels.
        var lineWidth = 0;
        var thisPixel = 0; // 0 black / 1 white.
        var lastPixel = 0; // 0 black / 1 white.

        for (var i = 0; i < pixels.Length; i++)
        {
            var pixelCoords = Utility.IndexToPoint(texture.width, i);
            // If within the skin objects min max boundries.
            // Also within an even more lenient threshold.
            if (pixelCoords.y < largestSkinObject.GetMaxPoint().y&&
                pixelCoords.y > largestSkinObject.GetMinPoint().y&&
                pixelCoords.x < largestSkinObject.GetMaxPoint().x&&
                pixelCoords.x > largestSkinObject.GetMinPoint().x&&
                PixelThreshold(pixels[i], threshold / 3))
            {
                lineWidth++;
                thisPixel = 1; // Skin pixel
                // Calculates 'center of mass'.
                largestSkinObject.AddToMean(pixelCoords);
                // Display Options - Show pixels after second segmentaiton.
                if (OPTIONS.SHOW_SEGMENTATION_SECOND)
                {
                    pixels[i] = Color.grey;
                }
            }
            else
            {
                // Send linewidth to the skin object and reset linewidth as
                // black pixel has been reached.
                largestSkinObject.TestWidth(lineWidth);
                lineWidth = 0;
                thisPixel = 0; // Black pixel.
                // Display Options - Show pixels after second segmentaiton.
                if (OPTIONS.SHOW_SEGMENTATION_SECOND)
                {
                    pixels[i] = Color.black;
                }
            }

            // Get a "good enough" contour point list for convex hull calculations.
            // Checks if the previous pixel was classed differently, then if true,
            // adds the current pixel to a list of contour points.
            if (thisPixel != lastPixel)
            {
                contourPoints.Add(pixelCoords);
            }

            lastPixel = thisPixel;
        }


        // Calculate convex hull using contour points.
        var hullPoints = ConvexHull.GetConvexHull(contourPoints);

        fingertipPoints = GetFingertips(hullPoints);



        // Display Options - Set contour pixels to green
        if (OPTIONS.SHOW_CONTOUR)
        {
            contourPoints.ForEach(point =>
            {
                pixels[Utility.PointToIndex(texture.width, point)] = Color.green;
            });
        }

        // Return array of edited pixels for display.
        return(pixels);
    }
Beispiel #15
0
        public void Start()
        {
            do
            {
                Console.WriteLine("\n\tDELETE PRODUCT\n");

                Console.WriteLine("Delete which product?\n");
                Console.WriteLine("(1) Find by ID");
                Console.WriteLine("(2) Find by Name");

                Console.WriteLine("(ESC) Return to Products menu");

                var keypress = Console.ReadKey();
                Console.WriteLine("");

                NorthwindContext db    = new NorthwindContext();
                DisplayOptions   disOp = new DisplayOptions();

                List <Product> results = null;

                if (keypress.Key == ConsoleKey.D1 || keypress.Key == ConsoleKey.NumPad1)
                {
                    Console.WriteLine("Please enter the ID of the product that you are searching for.");
                    int search = IntValidation(Console.ReadLine());


                    results = db.SearchProducts(search);
                }
                else if (keypress.Key == ConsoleKey.D2 || keypress.Key == ConsoleKey.NumPad2)
                {
                    Console.WriteLine("Please enter the Name of the product that you are searching for.");
                    string search = Console.ReadLine();

                    results = db.SearchProducts(search);
                }
                else if (keypress.Key == ConsoleKey.Escape)
                {
                    break;
                }
                else
                {
                    NLogger logging = new NLogger();

                    logging.Log("ERROR", "A valid key was not pressed. Please press (Y)es or (N)o.");
                }


                if (results == null)
                {
                }
                else if (results.Count() == 0)
                {
                }
                else if (results.Count() == 1)
                {
                    //disOp.DisplayProducts_Long(results);

                    this.Delete(results[0]);
                }
                else
                {
                    disOp.DisplayProducts_Short(results);


                    Console.WriteLine("Which Product?");
                    Console.Write("Enter the Row number: \t");

                    string choice = Console.ReadLine();
                    int    vInput = IntValidation(choice);


                    this.Delete(results[vInput - 1]);
                }
            } while (true);
        }
Beispiel #16
0
        private void WriteMemberTarget(MemberTarget target, DisplayOptions options, XmlWriter writer, Dictionary<IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            if(target == null)
                throw new ArgumentNullException("target");

            if(writer == null)
                throw new ArgumentNullException("writer");

            MethodTarget method = target as MethodTarget;

            if((options & DisplayOptions.ShowContainer) > 0)
            {
                WriteType(target.ContainingType, options & ~DisplayOptions.ShowContainer, writer);

                if(method != null && method.IsConversionOperator)
                    writer.WriteString(" ");
                else
                    WriteSeparator(writer);
            }

            // special logic for writing methods
            if(method != null)
            {
                WriteMethod(method, options, writer, dictionary);
                return;
            }

            // special logic for writing properties
            PropertyTarget property = target as PropertyTarget;

            if(property != null)
            {
                WriteProperty(property, options, writer);
                return;
            }

            // special logic for writing constructors
            ConstructorTarget constructor = target as ConstructorTarget;

            if(constructor != null)
            {
                WriteConstructor(constructor, options, writer);
                return;
            }

            // special logic for writing events
            EventTarget trigger = target as EventTarget;

            if(trigger != null)
            {
                WriteEvent(trigger, writer);
                return;
            }

            // by default, just write name
            writer.WriteString(target.Name);
        }
Beispiel #17
0
        private void WriteSpecialization(Specialization specialization, DisplayOptions options, XmlWriter writer)
        {
            // write the type itself (without outer types, because those will be written be other calls to this routine)
            WriteSimpleType(specialization.TemplateType, (options & ~DisplayOptions.ShowTemplates), false, writer);

            // then write the template arguments
            WriteTemplateArguments(specialization.Arguments, writer);
        }
Beispiel #18
0
 /// <summary>
 /// Write out a type reference
 /// </summary>
 /// <param name="type">The type reference information</param>
 /// <param name="options">The link display options</param>
 /// <param name="writer">The write to which the information is written</param>
 public void WriteType(TypeReference type, DisplayOptions options, XmlWriter writer)
 {
     WriteType(type, options, writer, null);
 }
Beispiel #19
0
        private void WriteTemplateType(TemplateTypeReference template, DisplayOptions options, XmlWriter writer, Dictionary<IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            // if we have the name, just write it
            NamedTemplateTypeReference namedTemplate = template as NamedTemplateTypeReference;

            if(namedTemplate != null)
            {
                writer.WriteString(namedTemplate.Name);
                return;
            }

            IndexedTemplateTypeReference indexedTemplate = template as IndexedTemplateTypeReference;

            if(indexedTemplate != null)
            {
                if(dictionary != null && dictionary.ContainsKey(indexedTemplate))
                    WriteType(dictionary[indexedTemplate], options, writer);
                else
                    writer.WriteString(GetTemplateName(indexedTemplate.TemplateId, indexedTemplate.Index));

                return;
            }

            TypeTemplateTypeReference typeTemplate = template as TypeTemplateTypeReference;

            if(typeTemplate != null)
            {

                TypeReference value = null;

                if(dictionary != null)
                {
                    IndexedTemplateTypeReference key = new IndexedTemplateTypeReference(typeTemplate.TemplateType.Id, typeTemplate.Position);

                    if(dictionary.ContainsKey(key))
                        value = dictionary[key];
                }

                if(value == null)
                    writer.WriteString(GetTypeTemplateName(typeTemplate.TemplateType, typeTemplate.Position));
                else
                    WriteType(value, options, writer);

                return;
            }

            throw new InvalidOperationException("Unknown template type");
        }
Beispiel #20
0
 public ItemComparer(DisplayOptions option, bool ascending)
 {
     this.Option    = option;
     this.Ascending = ascending;
 }
Beispiel #21
0
        public async Task <IEnumerable <Models.Task> > GetAllTasksForTeamAsync(int teamId, DisplayOptions options)
        {
            var allTasks = await _taskRepository.GetAllAsync();

            var allTasksForTean = allTasks.Where(x => x.TeamId == teamId);

            if (options.SortDirection == SortDirection.Ascending)
            {
                return(allTasksForTean.OrderBy(x => x.Name));
            }
            else
            {
                return(allTasksForTean.OrderByDescending(x => x.Name));
            }
        }
Beispiel #22
0
 private void WritePointerType(PointerTypeReference pointer, DisplayOptions options, XmlWriter writer, Dictionary<IndexedTemplateTypeReference, TypeReference> dictionary)
 {
     WriteType(pointer.PointedToType, options, writer, dictionary);
     writer.WriteString("*");
 }
Beispiel #23
0
        private void DrawColumnHeaders()
        {
            Rect columnsRect = GUILayoutUtility.GetRect(0, this.Tree.Config.DefaultMenuStyle.Height, GUILayoutOptions.ExpandWidth(true));

            EditorGUI.DrawRect(columnsRect, SirenixGUIStyles.DarkEditorBackground);

            //SirenixGUIStyles.Temporary.Draw(columnsRect, GUIContent.none, 0);

            int   columnIndex = 0;
            float currentX    = columnsRect.xMin;

            for (int i = 0; i < AllDisplayOptions.Length; i++)
            {
                DisplayOptions option = AllDisplayOptions[i];

                if ((this.Display & option) == option)
                {
                    float width = this.columns[columnIndex].ColWidth;
                    Rect  rect  = new Rect(currentX, columnsRect.yMin + 3, width - 0.5f, columnsRect.height);

                    rect.xMax = Math.Min(rect.xMax, columnsRect.xMax);

                    if (rect.width <= 0)
                    {
                        break;
                    }

                    string labelText = option == DisplayOptions.Category ? "" : option.ToString();

                    if (GUI.Button(rect, GUIHelper.TempContent(labelText), SirenixGUIStyles.BoldLabel))
                    {
                        if (this.SortBy == option)
                        {
                            this.SortAscending = !this.SortAscending;
                        }
                        else
                        {
                            this.SortBy        = option;
                            this.SortAscending = false;
                        }

                        this.shouldSort = true;
                    }

                    Rect       iconRect = rect.AlignRight(rect.height).Padding(3).SubY(3);
                    EditorIcon icon;

                    if (this.SortBy != option)
                    {
                        icon = EditorIcons.TriangleRight;
                        GUIHelper.PushColor(GUI.color * 0.7f);
                    }
                    else
                    {
                        icon = this.SortAscending ? EditorIcons.TriangleUp : EditorIcons.TriangleDown;
                    }

                    icon.Draw(iconRect);

                    if (this.SortBy != option)
                    {
                        GUIHelper.PopColor();
                    }

                    currentX += width;
                    columnIndex++;
                }
            }

            SirenixEditorGUI.DrawHorizontalLineSeperator(columnsRect.xMin, columnsRect.yMax, columnsRect.width, 0.5f);
        }
Beispiel #24
0
        /// <summary>
        /// Write out a member reference
        /// </summary>
        /// <param name="member">The member reference information</param>
        /// <param name="options">The link display options</param>
        /// <param name="writer">The write to which the information is written</param>
        public void WriteMember(MemberReference member, DisplayOptions options, XmlWriter writer)
        {
            if(member == null)
                throw new ArgumentNullException("member");

            if(writer == null)
                throw new ArgumentNullException("writer");

            SimpleMemberReference simple = member as SimpleMemberReference;
            if(simple != null)
            {
                WriteSimpleMember(simple, options, writer);
                return;
            }

            SpecializedMemberReference special = member as SpecializedMemberReference;
            if(special != null)
            {
                WriteSpecializedMember(special, options, writer);
                return;
            }

            SpecializedMemberWithParametersReference ugly = member as SpecializedMemberWithParametersReference;
            if(ugly != null)
            {
                WriteSpecializedMemberWithParameters(ugly, options, writer);
                return;
            }

            throw new InvalidOperationException("Unknown member reference type");

        }
Beispiel #25
0
            public ValidationInfoMenuItem(OdinMenuTree tree, ValidationResult validationResult, ValidationProfileResult profileResult, ResizableColumn[] columns, DisplayOptions displayOptions, int originalItemIndex) : base(tree, "", validationResult)
            {
                this.ValidationResult  = validationResult;
                this.ProfileResult     = profileResult;
                this.Columns           = columns;
                this.DisplayOptions    = displayOptions;
                this.OriginalItemIndex = originalItemIndex;

                if (this.ProfileResult.SourceRecoveryData is SceneValidationProfile.SceneAddress)
                {
                    SceneValidationProfile.SceneAddress address = (SceneValidationProfile.SceneAddress) this.ProfileResult.SourceRecoveryData;
                    SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath <SceneAsset>(address.ScenePath);
                    this.SceneName = sceneAsset != null ? sceneAsset.name : "";
                }
                else
                {
                    this.SceneName = "";
                }

                this.SearchString = string.Join(" ", AllDisplayOptions.Select(x => this.GetDisplayString(x)).ToArray());
            }
Beispiel #26
0
        private void WriteMethod(MethodTarget target, DisplayOptions options, XmlWriter writer, Dictionary<IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            WriteProcedureName(target, writer);

            if((options & DisplayOptions.ShowTemplates) > 0)
            {
                // if this is a generic method, write any template params or args
                if(target.TemplateArgs != null && target.TemplateArgs.Count > 0)
                    WriteTemplateArguments(target.TemplateArgs, writer);
            }

            if((options & DisplayOptions.ShowParameters) > 0)
            {
                if(target.IsConversionOperator)
                    WriteConversionOperatorParameters(target.Parameters, target.ReturnType, writer, dictionary);
                else
                    WriteMethodParameters(target.Parameters, writer, dictionary);
            }
        }
Beispiel #27
0
            public override void DrawMenuItem(int indentLevel)
            {
                base.DrawMenuItem(indentLevel);

                if (!this.MenuItemIsBeingRendered || Event.current.type != EventType.Repaint)
                {
                    return;
                }

                Rect totalRect = this.Rect;

                int   columnIndex = 0;
                float currentX    = totalRect.xMin;

                for (int i = 0; i < AllDisplayOptions.Length; i++)
                {
                    DisplayOptions option = AllDisplayOptions[i];

                    if ((this.DisplayOptions & option) == option)
                    {
                        float width = this.Columns[columnIndex].ColWidth;
                        Rect  rect  = new Rect(currentX, totalRect.yMin, width, totalRect.height);

                        if (option == DisplayOptions.Category)
                        {
                            rect = rect.AlignCenter(16, 16);

                            switch (this.ValidationResult.ResultType)
                            {
                            case ValidationResultType.Valid:
                                GUIHelper.PushColor(Color.green);
                                GUI.DrawTexture(rect, EditorIcons.Checkmark.Highlighted, ScaleMode.ScaleToFit);
                                GUIHelper.PopColor();
                                break;

                            case ValidationResultType.Error:
                                GUI.DrawTexture(rect, EditorIcons.UnityErrorIcon, ScaleMode.ScaleToFit);
                                break;

                            case ValidationResultType.Warning:
                                GUI.DrawTexture(rect, EditorIcons.UnityWarningIcon, ScaleMode.ScaleToFit);
                                break;

                            default:
                                break;
                            }
                        }
                        else
                        {
                            rect.y      = this.LabelRect.y;
                            rect.yMax   = this.LabelRect.yMax;
                            rect.x     += 5;
                            rect.width -= 10;

                            GUIStyle labelStyle = this.IsSelected ? this.Style.SelectedLabelStyle : this.Style.DefaultLabelStyle;
                            GUI.Label(rect, GUIHelper.TempContent(this.GetDisplayString(option)), labelStyle);
                        }

                        currentX += width;
                        columnIndex++;
                    }
                }
            }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the SimpleRootSiteDataProviderVc class
		/// </summary>
		/// <param name="options"></param>
		/// ------------------------------------------------------------------------------------
		public SimpleRootSiteDataProvider_MultiStringViewVc(DisplayOptions options)
		{
			m_displayOptions = options;
		}
Beispiel #29
0
 public void ResetSortingSettings()
 {
     this.SortBy        = DisplayOptions.None;
     this.SortAscending = false;
 }
Beispiel #30
0
        private void WriteProperty(PropertyTarget target, DisplayOptions options, XmlWriter writer)
        {
            WriteProcedureName(target, writer);

            if((options & DisplayOptions.ShowParameters) > 0)
            {
                IList<Parameter> parameters = target.Parameters;

                if(parameters.Count > 0)
                {
                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "languageSpecificText");
                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "cs");
                    writer.WriteString("[");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "vb");
                    writer.WriteString("(");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "cpp");
                    writer.WriteString("[");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "nu");
                    writer.WriteString("(");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "fs");
                    writer.WriteString(" ");
                    writer.WriteEndElement();

                    writer.WriteEndElement();

                    // show parameters
                    // we need to deal with type template substitutions!
                    for(int i = 0; i < parameters.Count; i++)
                    {
                        if(i > 0)
                            writer.WriteString(", ");

                        WriteType(parameters[i].ParameterType, DisplayOptions.Default, writer);
                    }

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "languageSpecificText");
                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "cs");
                    writer.WriteString("]");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "vb");
                    writer.WriteString(")");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "cpp");
                    writer.WriteString("]");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "nu");
                    writer.WriteString(")");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "fs");
                    writer.WriteString(" ");
                    writer.WriteEndElement();

                    writer.WriteEndElement();
                }
            }
        }
        public async Task <IActionResult> AllSprints(int teamId, DisplayOptions options)
        {
            List <Sprint> sprints;

            if (await _accessCheckService.OwnerOrMemberAsync(teamId))
            {
                sprints = (List <Sprint>) await _manageSprintsService.GetAllSprintsAsync(teamId, options);
            }
            else
            {
                return(View("ErrorGetAllSprints"));
            }

            List <TeamMember> teamMembers = await GetAllTeamMembersAsync(teamId, new DisplayOptions { });

            var sprintViewModel = new SprintAndTeamViewModel
            {
                Sprints = new List <SprintViewModel>()
            };

            if (await _accessCheckService.IsOwnerAsync(teamId))
            {
                sprintViewModel.IsOwner = true;
            }
            else
            {
                sprintViewModel.IsOwner = false;
            }
            sprints.OrderBy(s => s.Status).ToList().ForEach(t => sprintViewModel.Sprints.Add(new SprintViewModel()
            {
                Id                = t.Id,
                DaysInSprint      = t.DaysInSprint,
                Status            = t.Status,
                Name              = t.Name,
                StoryPointInHours = t.StoryPointInHours,
                TeamId            = t.TeamId
            }
                                                                                             ));

            if (sprintViewModel.Sprints.Count > 1 && sprintViewModel.Sprints[1].Status == PossibleStatuses.ActiveStatus)
            {
                var swapElem = sprintViewModel.Sprints[0];
                sprintViewModel.Sprints[0] = sprintViewModel.Sprints[1];
                sprintViewModel.Sprints[1] = swapElem;
            }

            var team = await _manageSprintsService.GetTeam(teamId);

            sprintViewModel.Team = new TeamViewModel()
            {
                Id          = team.Id,
                Owner       = team.Owner,
                TeamName    = team.TeamName,
                TeamMembers = new List <TeamMemberViewModel>()
            };

            teamMembers.ForEach(t => sprintViewModel.Team.TeamMembers.Add(new TeamMemberViewModel()
            {
                Member   = t.Member,
                MemberId = t.MemberId
            }));

            return(View(sprintViewModel));
        }
Beispiel #32
0
        private void WriteSpecializedMemberWithParameters(SpecializedMemberWithParametersReference ugly, DisplayOptions options, XmlWriter writer)
        {
            if((options & DisplayOptions.ShowContainer) > 0)
            {
                WriteSpecializedType(ugly.SpecializedType, options & ~DisplayOptions.ShowContainer, writer);
                WriteSeparator(writer);
            }

            writer.WriteString(ugly.MemberName);

            if((options & DisplayOptions.ShowParameters) > 0)
            {
                writer.WriteString("(");

                IList<TypeReference> parameterTypes = ugly.ParameterTypes;

                for(int i = 0; i < parameterTypes.Count; i++)
                {
                    if(i > 0)
                        writer.WriteString(", ");

                    WriteType(parameterTypes[i], DisplayOptions.Default, writer);
                }

                writer.WriteString(")");
            }
        }
Beispiel #33
0
 public static void Display(DisplayOptions options)
 {
     _currentOptions = options;
     AlertExternMethods.UnityDisplayAlertDialog(options.title, options.message,
                                                options.positiveButtonTitle, options.negativeButtonTitle, options.neutralButtonTitle);
 }
Beispiel #34
0
 /// <summary>
 /// Write out a member target
 /// </summary>
 /// <param name="target">The member target information</param>
 /// <param name="options">The link display options</param>
 /// <param name="writer">The write to which the information is written</param>
 public void WriteMemberTarget(MemberTarget target, DisplayOptions options, XmlWriter writer)
 {
     WriteMemberTarget(target, options, writer, null);
 }
Beispiel #35
0
        /// <inheritdoc />
        public async Task <CloudFlareResult <IReadOnlyList <Membership> > > GetAsync(MembershipFilter filter = null, DisplayOptions displayOptions = null, CancellationToken cancellationToken = default)
        {
            var builder = new ParameterBuilderHelper();

            builder
            .InsertValue(Filtering.Status, filter?.Status)
            .InsertValue(Filtering.AccountName, filter?.AccountName)
            .InsertValue(Filtering.Order, filter?.MembershipOrder)
            .InsertValue(Filtering.Page, displayOptions?.Page)
            .InsertValue(Filtering.PerPage, displayOptions?.PerPage)
            .InsertValue(Filtering.Direction, displayOptions?.Order);

            var requestUri = $"{MembershipEndpoints.Base}";

            if (builder.ParameterCollection.HasKeys())
            {
                requestUri = $"{requestUri}/?{builder.ParameterCollection}";
            }

            return(await Connection.GetAsync <IReadOnlyList <Membership> >(requestUri, cancellationToken).ConfigureAwait(false));
        }
Beispiel #36
0
        /// <summary>
        /// Write out a reference
        /// </summary>
        /// <param name="reference">The reference information</param>
        /// <param name="options">The link display options</param>
        /// <param name="writer">The write to which the information is written</param>
        public void WriteReference(Reference reference, DisplayOptions options, XmlWriter writer)
        {
            if(reference == null)
                throw new ArgumentNullException("reference");

            if(writer == null)
                throw new ArgumentNullException("writer");

            NamespaceReference space = reference as NamespaceReference;

            if(space != null)
            {
                WriteNamespace(space, writer);
                return;
            }

            TypeReference type = reference as TypeReference;

            if(type != null)
            {
                WriteType(type, options, writer);
                return;
            }

            MemberReference member = reference as MemberReference;

            if(member != null)
            {
                WriteMember(member, options, writer);
                return;
            }

            ExtensionMethodReference extMethod = reference as ExtensionMethodReference;

            if(extMethod != null)
            {
                WriteExtensionMethod(extMethod, options, writer);
                return;
            }

            InvalidReference invalid = reference as InvalidReference;

            if(invalid != null)
            {
                WriteInvalid(invalid, writer);
                return;
            }

            throw new InvalidOperationException("Unknown target type");
        }
Beispiel #37
0
 public static void SetDisplayOption(Image obj, DisplayOptions value)
 {
     obj.SetValue(DisplayOptionProperty, value);
 }
Beispiel #38
0
        /// <summary>
        /// Write out a type reference
        /// </summary>
        /// <param name="type">The type reference information</param>
        /// <param name="options">The link display options</param>
        /// <param name="writer">The write to which the information is written</param>
        /// <param name="dictionary">The template type dictionary</param>
        private void WriteType(TypeReference type, DisplayOptions options, XmlWriter writer, Dictionary<IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            if(type == null)
                throw new ArgumentNullException("type");
            if(writer == null)
                throw new ArgumentNullException("writer");

            SimpleTypeReference simple = type as SimpleTypeReference;
            if(simple != null)
            {
                WriteSimpleType(simple, options, writer);
                return;
            }

            SpecializedTypeReference specialized = type as SpecializedTypeReference;
            if(specialized != null)
            {
                WriteSpecializedType(specialized, options, writer);
                return;
            }

            ArrayTypeReference array = type as ArrayTypeReference;
            if(array != null)
            {
                WriteArrayType(array, options, writer, dictionary);
                return;
            }

            ReferenceTypeReference reference = type as ReferenceTypeReference;
            if(reference != null)
            {
                WriteReferenceType(reference, options, writer, dictionary);
                return;
            }

            PointerTypeReference pointer = type as PointerTypeReference;
            if(pointer != null)
            {
                WritePointerType(pointer, options, writer, dictionary);
                return;
            }

            TemplateTypeReference template = type as TemplateTypeReference;
            if(template != null)
            {
                WriteTemplateType(template, options, writer, dictionary);
                return;
            }

            throw new InvalidOperationException("Unknown type reference type");
        }
 public PreviewControllerHelper(IContentLoader contentLoader, TemplateResolver templateResolver, DisplayOptions displayOptions, HttpContextBase httpContext)
 {
     _contentLoader    = contentLoader;
     _templateResolver = templateResolver;
     _displayOptions   = displayOptions;
     _httpContext      = httpContext;
 }
Beispiel #40
0
 private void WriteSimpleType(SimpleTypeReference simple, DisplayOptions options, bool showOuterType, XmlWriter writer)
 {
     TypeTarget type = targets[simple.Id] as TypeTarget;
     if(type != null)
     {
         WriteTypeTarget(type, options, showOuterType, writer);
     }
     else
     {
         TextReferenceUtilities.WriteSimpleTypeReference(simple, options, writer);
     }
 }
Beispiel #41
0
        /// <summary>
        /// Changes resolution of all elements in the game - just calls ResolutionChanged method of all elements in the game.
        /// </summary>
        /// <param name="newResolution">Value of resolution after change.</param>
        public static void ResolutionChanged(Vector2 newResolution)
        {
            DisplayOptions.ActualiseResolution(newResolution);

            MenuScreenManager.ResolutionChanged();
        }
Beispiel #42
0
        private void WriteSpecializedType(SpecializedTypeReference special, DisplayOptions options, XmlWriter writer)
        {
            IList<Specialization> specializations = special.Specializations;

            for(int i = 0; i < specializations.Count; i++)
                if(i == 0)
                    WriteSpecialization(specializations[0], options, writer);
                else
                {
                    WriteSeparator(writer);
                    WriteSpecialization(specializations[i], options & ~DisplayOptions.ShowContainer, writer);
                }
        }
Beispiel #43
0
        public void Start()
        {
            do
            {
                Console.WriteLine("\n\tDISPLAY CATEGORIES\n");

                Console.WriteLine("(1) Display all Categories");
                Console.WriteLine("(2) Display a Category with all related products");

                Console.WriteLine("Press ESC to go back");

                var keypress = Console.ReadKey();
                Console.WriteLine("");

                DisplayOptions disOp = new DisplayOptions();

                //Display all categories
                if (keypress.Key == ConsoleKey.D1 || keypress.Key == ConsoleKey.NumPad1)
                {
                    disOp.DisplayAllCategories();
                }
                else if (keypress.Key == ConsoleKey.D2 || keypress.Key == ConsoleKey.NumPad2)
                {
                    Console.WriteLine("What Category are you looking for? \n");

                    Console.WriteLine("(1) Search by ID");
                    Console.WriteLine("(2) Search by Name");
                    Console.WriteLine("(3) Search by Description");

                    var keypress2 = Console.ReadKey();
                    Console.WriteLine("");

                    Category        choice  = null;
                    List <Category> results = null;

                    if (keypress2.Key == ConsoleKey.D1 || keypress2.Key == ConsoleKey.NumPad1)
                    {
                        Console.WriteLine("What is the ID of the Category you want to display?");
                        int toFind = IntValidation(Console.ReadLine());

                        results = db.SearchCategory(toFind).ToList();
                    }
                    else if (keypress2.Key == ConsoleKey.D2 || keypress2.Key == ConsoleKey.NumPad2)
                    {
                        Console.WriteLine("What is the Name of the Category you want to display?");
                        string toFind = Console.ReadLine();

                        results = db.SearchCategory(toFind, true).ToList();
                    }
                    else if (keypress2.Key == ConsoleKey.D3 || keypress2.Key == ConsoleKey.NumPad3)
                    {
                        Console.WriteLine("What is the Description of the Category you want to display?");
                        string toFind = Console.ReadLine();

                        results = db.SearchCategory(toFind, false).ToList();
                    }
                    else
                    {
                        logging.Log("WARN", "Please press a valid option. Try again.");
                    }



                    if (results == null)
                    {
                    }

                    else if (results.Count == 0)
                    {
                    }
                    else if (results.Count == 1)
                    {
                        disOp.DisplayCategory(results[0]);
                        choice = results[0];
                    }
                    else
                    {
                        int row = 0;

                        foreach (var category in results)
                        {
                            Console.WriteLine("Row: {0}", row++);
                            disOp.DisplayCategory(category);
                            Console.WriteLine("");
                        }


                        Console.WriteLine("Which Category would you like to display?");
                        Console.Write("Enter the Row number: \t");

                        string rowChoice = Console.ReadLine();
                        int    vInput    = IntValidation(rowChoice);


                        choice = results[vInput - 1];
                    }



                    if (results.Count > 0)
                    {
                        Console.WriteLine("(1) Display all Products");
                        Console.WriteLine("(2) Display only active Products");
                        Console.WriteLine("(3) Display only discontinued Products");

                        var keypress3 = Console.ReadKey();
                        Console.WriteLine("");

                        if (choice == null)
                        {
                        }

                        else if (keypress3.Key == ConsoleKey.D1 || keypress3.Key == ConsoleKey.NumPad1)
                        {
                            disOp.DisplayCategoryAndProducts(choice);
                        }
                        else if (keypress3.Key == ConsoleKey.D2 || keypress3.Key == ConsoleKey.NumPad2)
                        {
                            disOp.DisplayCategoryAndActiveProducts(choice);
                        }
                        else if (keypress3.Key == ConsoleKey.D3 || keypress3.Key == ConsoleKey.NumPad3)
                        {
                            disOp.DisplayCategoryAndDiscontinuedProducts(choice);
                        }
                        else
                        {
                            logging.Log("WARN", "Please press a valid option. Try again.");
                        }
                    }
                }
                else if (keypress.Key == ConsoleKey.Escape)
                {
                    break;
                }
                else
                {
                    logging.Log("WARN", "Please press a valid option. Try again.");
                }
            } while (true);
        }
Beispiel #44
0
        private void WriteArrayType(ArrayTypeReference reference, DisplayOptions options, XmlWriter writer, Dictionary<IndexedTemplateTypeReference, TypeReference> dictionary)
        {

            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "languageSpecificText");
            // C++ array notation (left)
            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "cpp");
            writer.WriteString("array<");
            writer.WriteEndElement();
            writer.WriteEndElement(); // end of <span class="languageSpecificText"> element

            // the underlying type
            WriteType(reference.ElementType, options, writer, dictionary);

            // C++ array notation (right)
            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "languageSpecificText");
            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "cpp");

            if(reference.Rank > 1)
                writer.WriteString("," + reference.Rank.ToString(CultureInfo.InvariantCulture));

            writer.WriteString(">");
            writer.WriteEndElement();

            // C# array notation
            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "cs");
            writer.WriteString("[");

            for(int i = 1; i < reference.Rank; i++)
                writer.WriteString(",");

            writer.WriteString("]");
            writer.WriteEndElement();

            // VB array notation
            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "vb");
            writer.WriteString("(");

            for(int i = 1; i < reference.Rank; i++)
                writer.WriteString(",");

            writer.WriteString(")");
            writer.WriteEndElement();

            // neutral array notation
            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "nu");
            writer.WriteString("[");

            for(int i = 1; i < reference.Rank; i++)
                writer.WriteString(",");

            writer.WriteString("]");
            writer.WriteEndElement();

            // F# array notation
            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "fs");
            writer.WriteString("[");

            for(int i = 1; i < reference.Rank; i++)
                writer.WriteString(",");

            writer.WriteString("]");
            writer.WriteEndElement();

            writer.WriteEndElement(); // end of <span class="languageSpecificText"> element
        }
 public PreviewController(IContentLoader contentLoader, TemplateResolver templateResolver, DisplayOptions displayOptions)
 {
     _contentLoader    = contentLoader;
     _templateResolver = templateResolver;
     _displayOptions   = displayOptions;
 }
Beispiel #46
0
        private void WriteReferenceType(ReferenceTypeReference reference, DisplayOptions options, XmlWriter writer, Dictionary<IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            WriteType(reference.ReferredToType, options, writer, dictionary);

            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "languageSpecificText");
            // add % in C++
            writer.WriteStartElement("span");
            writer.WriteAttributeString("class", "cpp");
            writer.WriteString("%");
            writer.WriteEndElement();
            writer.WriteEndElement();
        }
Beispiel #47
0
        /// <inheritdoc />
        public override void Apply(XmlDocument document, string key)
        {
            Target target = null, keyTarget;
            string msdnUrl = null;

            foreach (XPathNavigator linkNode in document.CreateNavigator().Select(referenceLinkExpression).ToArray())
            {
                // Extract link information
                ReferenceLinkInfo link = new ReferenceLinkInfo(linkNode);

                // Determine target, link type, and display options
                string            targetId = link.Target;
                DisplayOptions    options  = link.DisplayOptions;
                ReferenceLinkType type     = ReferenceLinkType.None;

                if (String.IsNullOrWhiteSpace(targetId))
                {
                    this.WriteMessage(key, MessageLevel.Warn, "The target attribute is missing or has no " +
                                      "value.  You have most likely omitted a cref attribute or left it blank on an XML " +
                                      "comments element such as see, seealso, or exception.");
                    continue;
                }

                bool targetFound = targets.TryGetValue(targetId, out target, out type);

                // If not found and it starts with "System." or "Microsoft." we'll go with the assumption that
                // it's part of a Microsoft class library that is not part of the core framework but does have
                // documentation available on MSDN.  Worst case it doesn't and we get an unresolved link warning
                // instead of an unknown reference target warning.
                if (!targetFound && ((targetId.Length > 9 && targetId.Substring(2).StartsWith("System.",
                                                                                              StringComparison.Ordinal)) || (targetId.Length > 12 && targetId.Substring(2).StartsWith(
                                                                                                                                 "Microsoft.", StringComparison.Ordinal))))
                {
                    // Use the same link type as a core framework class
                    targetFound = targets.TryGetValue("T:System.Object", out target, out type);

                    // We don't have a target in this case so links to overloads pages won't work.  Also note
                    // that the link text will be generated from the ID which shouldn't make much of a difference
                    // in most cases.  If either case is an issue, the Additional Reference Links SHFB plug-in
                    // can be used to generate valid link target data.
                    target = null;
                }

                if (!targetFound)
                {
                    // If not being rendered as a link, don't report a warning
                    if (link.RenderAsLink && targetId != key)
                    {
                        base.WriteMessage(key, MessageLevel.Warn, "Unknown reference link target '{0}'.", targetId);
                    }

                    // !EFW - Turn off the Show Parameters option for unresolved elements except methods.  If
                    // not, it outputs an empty "()" after the member name which looks odd.
                    if (targetId[0] != 'M')
                    {
                        options &= ~DisplayOptions.ShowParameters;
                    }
                }
                else
                {
                    // If overload is preferred and found, change targetId and make link options hide parameters
                    if (link.PreferOverload && target != null)
                    {
                        bool isConversionOperator = false;

                        MethodTarget method = target as MethodTarget;

                        if (method != null)
                        {
                            isConversionOperator = method.IsConversionOperator;
                        }

                        MemberTarget member = target as MemberTarget;

                        // If conversion operator is found, always link to individual topic
                        if (member != null && !String.IsNullOrEmpty(member.OverloadId) && !isConversionOperator)
                        {
                            Target overloadTarget = targets[member.OverloadId];

                            if (overloadTarget != null)
                            {
                                target   = overloadTarget;
                                targetId = overloadTarget.Id;
                            }
                        }

                        // If individual conversion operator is found, always display parameters
                        if (isConversionOperator && member != null && !String.IsNullOrEmpty(member.OverloadId))
                        {
                            options = options | DisplayOptions.ShowParameters;
                        }
                        else
                        {
                            options = options & ~DisplayOptions.ShowParameters;
                        }
                    }

                    // If link type is Local or Index, determine which
                    if (type == ReferenceLinkType.LocalOrIndex)
                    {
                        if (targets.TryGetValue(key, out keyTarget) && target != null && target.Container == keyTarget.Container)
                        {
                            type = ReferenceLinkType.Local;
                        }
                        else
                        {
                            type = ReferenceLinkType.Index;
                        }
                    }
                }

                // Suppress the link if so requested.  Links to this page are not live.
                if (!link.RenderAsLink)
                {
                    type = ReferenceLinkType.None;
                }
                else
                if (targetId == key)
                {
                    type = ReferenceLinkType.Self;
                }
                else
                if (target != null && targets.TryGetValue(key, out keyTarget) && target.File == keyTarget.File)
                {
                    type = ReferenceLinkType.Self;
                }

                // !EFW - Redirect enumeration fields to the containing enumerated type so that we
                // get a valid link target.  Enum fields don't have a topic to themselves.
                if (type != ReferenceLinkType.None && type != ReferenceLinkType.Self && type != ReferenceLinkType.Local &&
                    targetId.StartsWith("F:", StringComparison.OrdinalIgnoreCase))
                {
                    MemberTarget member = target as MemberTarget;

                    if (member != null)
                    {
                        SimpleTypeReference typeRef = member.ContainingType as SimpleTypeReference;

                        if (typeRef != null && targets[typeRef.Id] is EnumerationTarget)
                        {
                            targetId = typeRef.Id;
                        }
                    }
                }

                // Get MSDN endpoint if needed
                if (type == ReferenceLinkType.Msdn)
                {
                    if (msdnResolver != null && !msdnResolver.IsDisabled)
                    {
                        msdnUrl = msdnResolver.GetMsdnUrl(targetId);

                        if (String.IsNullOrEmpty(msdnUrl))
                        {
                            // If the web service failed, report the reason
                            if (msdnResolver.IsDisabled)
                            {
                                base.WriteMessage(key, MessageLevel.Warn, "MSDN web service failed.  No " +
                                                  "further look ups will be performed for this build.\r\nReason: {0}",
                                                  msdnResolver.DisabledReason);
                            }
                            else
                            {
                                base.WriteMessage(key, MessageLevel.Warn, "MSDN URL not found for target '{0}'.",
                                                  targetId);
                            }

                            type = ReferenceLinkType.None;
                        }
                    }
                    else
                    {
                        type = ReferenceLinkType.None;
                    }
                }

                // Write opening link tag and target info
                XmlWriter writer = linkNode.InsertAfter();

                switch (type)
                {
                case ReferenceLinkType.None:
                    writer.WriteStartElement("span");

                    // If the link was intentionally suppressed, write it out as an identifier (i.e. links
                    // in the syntax section).
                    if (link.RenderAsLink)
                    {
                        writer.WriteAttributeString("class", "nolink");
                    }
                    else
                    {
                        writer.WriteAttributeString("class", "identifier");
                    }
                    break;

                case ReferenceLinkType.Self:
                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "selflink");
                    break;

                case ReferenceLinkType.Local:
                    // Format link with prefix and/or postfix
                    string href = String.Format(CultureInfo.InvariantCulture, hrefFormat, target.File);

                    // Make link relative, if we have a baseUrl
                    if (baseUrl != null)
                    {
                        href = href.GetRelativePath(document.EvalXPathExpr(baseUrl, "key", key));
                    }

                    writer.WriteStartElement("a");
                    writer.WriteAttributeString("href", href);
                    break;

                case ReferenceLinkType.Index:
                    writer.WriteStartElement("MSHelp", "link", "http://msdn.microsoft.com/mshelp");
                    writer.WriteAttributeString("keywords", targetId);
                    writer.WriteAttributeString("tabindex", "0");
                    break;

                case ReferenceLinkType.Msdn:
                    writer.WriteStartElement("a");
                    writer.WriteAttributeString("href", msdnUrl);
                    writer.WriteAttributeString("target", linkTarget);
                    break;

                case ReferenceLinkType.Id:
                    writer.WriteStartElement("a");
                    writer.WriteAttributeString("href", ("ms-xhelp:///?Id=" + targetId).Replace("#", "%23"));
                    break;
                }

                // Write the link text
                if (String.IsNullOrEmpty(link.DisplayTarget))
                {
                    if (link.Contents == null)
                    {
                        if (target != null)
                        {
                            resolver.WriteTarget(target, options, writer);
                        }
                        else
                        {
                            Reference reference = TextReferenceUtilities.CreateReference(targetId);

                            if (reference is InvalidReference)
                            {
                                base.WriteMessage(key, MessageLevel.Warn,
                                                  "Invalid reference link target '{0}'.", targetId);
                            }

                            resolver.WriteReference(reference, options, writer);
                        }
                    }
                    else
                    {
                        do
                        {
                            link.Contents.WriteSubtree(writer);
                        } while(link.Contents.MoveToNext());
                    }
                }
                else
                {
                    if (link.DisplayTarget.Equals("content", StringComparison.OrdinalIgnoreCase) &&
                        link.Contents != null)
                    {
                        // Use the contents as an XML representation of the display target
                        Reference reference = XmlTargetDictionaryUtilities.CreateReference(link.Contents);
                        resolver.WriteReference(reference, options, writer);
                    }

                    if (link.DisplayTarget.Equals("format", StringComparison.OrdinalIgnoreCase) &&
                        link.Contents != null)
                    {
                        // Use the contents as a format string for the display target
                        string format = link.Contents.OuterXml;
                        string input  = null;

                        using (StringWriter textStore = new StringWriter(CultureInfo.InvariantCulture))
                        {
                            XmlWriterSettings settings = new XmlWriterSettings();
                            settings.ConformanceLevel = ConformanceLevel.Fragment;

                            using (XmlWriter xmlStore = XmlWriter.Create(textStore, settings))
                            {
                                if (target != null)
                                {
                                    resolver.WriteTarget(target, options, xmlStore);
                                }
                                else
                                {
                                    Reference reference = TextReferenceUtilities.CreateReference(targetId);
                                    resolver.WriteReference(reference, options, xmlStore);
                                }
                            }

                            input = textStore.ToString();
                        }

                        string output = String.Format(CultureInfo.InvariantCulture, format, input);

                        XmlDocumentFragment fragment = document.CreateDocumentFragment();
                        fragment.InnerXml = output;
                        fragment.WriteTo(writer);
                    }
                    else if (link.DisplayTarget.Equals("extension", StringComparison.OrdinalIgnoreCase) &&
                             link.Contents != null)
                    {
                        Reference extMethodReference = XmlTargetDictionaryUtilities.CreateExtensionMethodReference(link.Contents);
                        resolver.WriteReference(extMethodReference, options, writer);
                    }
                    else
                    {
                        // Use the display target value as a CER for the display target
                        TextReferenceUtilities.SetGenericContext(key);
                        Reference reference = TextReferenceUtilities.CreateReference(link.DisplayTarget);
                        resolver.WriteReference(reference, options, writer);
                    }
                }

                // Write the closing link tag
                writer.WriteEndElement();
                writer.Close();

                // Delete the original tag
                linkNode.DeleteSelf();
            }
        }
Beispiel #48
0
        /// <summary>
        /// Write out an extension method reference
        /// </summary>
        /// <param name="extMethod">The extension method reference information</param>
        /// <param name="options">The link display options</param>
        /// <param name="writer">The write to which the information is written</param>
        public void WriteExtensionMethod(ExtensionMethodReference extMethod, DisplayOptions options, XmlWriter writer)
        {
            if(extMethod == null)
                throw new ArgumentNullException("extMethod");

            if(writer == null)
                throw new ArgumentNullException("writer");

            // write the unqualified method name
            writer.WriteString(extMethod.Name);

            // if this is a generic method, write any template params or args
            if(extMethod.TemplateArgs != null && extMethod.TemplateArgs.Count > 0)
                WriteTemplateArguments(extMethod.TemplateArgs, writer);

            // write parameters
            if((options & DisplayOptions.ShowParameters) > 0)
                WriteMethodParameters(extMethod.Parameters, writer);
        }
Beispiel #49
0
 BrExLayout IPlasticAPI.GetBranchExplorerLayout(WorkspaceInfo wkInfo, RepositorySpec repSpec, FilterCollection filters, DisplayOptions options, out BrExTree explorerTree)
 {
     throw new NotImplementedException();
 }
Beispiel #50
0
        private void WriteSpecializedMember(SpecializedMemberReference member, DisplayOptions options, XmlWriter writer)
        {
            if((options & DisplayOptions.ShowContainer) > 0)
            {
                WriteType(member.SpecializedType, options & ~DisplayOptions.ShowContainer, writer);
                WriteSeparator(writer);
            }

            WriteSimpleMember(member.TemplateMember, options & ~DisplayOptions.ShowContainer, writer,
                member.SpecializedType.SpecializationDictionary);
        }
Beispiel #51
0
 BrExLayout IPlasticAPI.GetBranchExplorerLayout(WorkspaceInfo wkInfo, RepositoryExplainMergeData explainMergeData, DisplayOptions displayOptions, out BrExTree explorerTree)
 {
     throw new NotImplementedException();
 }
Beispiel #52
0
        private void WriteSimpleMember(SimpleMemberReference member, DisplayOptions options, XmlWriter writer, Dictionary<IndexedTemplateTypeReference, TypeReference> dictionary)
        {
            MemberTarget target = targets[member.Id] as MemberTarget;

            if(target != null)
                WriteMemberTarget(target, options, writer, dictionary);
            else
                TextReferenceUtilities.WriteSimpleMemberReference(member, options, writer, this);
        }
Beispiel #53
0
 BrExLayout IPlasticAPI.GetBranchExplorerLayout(RepositorySpec repSpec, BrExTree explorerTree, DisplayOptions options)
 {
     throw new NotImplementedException();
 }
Beispiel #54
0
        private ImageSource GetBitmapSource(LoadImageRequest loadTask, DisplayOptions loadType)
        {
            Image image = loadTask.Image;
            string source = loadTask.Source;

            ImageSource imageSource = null;

            if (!string.IsNullOrWhiteSpace(source))
            {
                Stream imageStream = null;

                SourceType sourceType = SourceType.LocalDisk;

                image.Dispatcher.Invoke(new ThreadStart(delegate
                {
                    sourceType = Loader.GetSourceType(image);
                }));

                try
                {
                    if (loadTask.Stream == null)
                    {
                        ILoader loader = LoaderFactory.CreateLoader(sourceType);
                        imageStream = loader.Load(source);
                        loadTask.Stream = imageStream;
                    }
                    else
                    {
                        imageStream = new MemoryStream();
                        loadTask.Stream.Position = 0;
                        loadTask.Stream.CopyTo(imageStream);
                        imageStream.Position = 0;
                    }
                }
                catch (Exception) { }

                if (imageStream != null)
                {
                    try
                    {
                        if (loadType == DisplayOptions.Preview)
                        {
                            BitmapFrame bitmapFrame = BitmapFrame.Create(imageStream);
                            imageSource = bitmapFrame.Thumbnail;

                            if (imageSource == null) // Preview it is not embedded into the file
                            {
                                // we'll make a thumbnail image then ... (too bad as the pre-created one is FAST!)
                                TransformedBitmap thumbnail = new TransformedBitmap();
                                thumbnail.BeginInit();
                                thumbnail.Source = bitmapFrame as BitmapSource;

                                // we'll make a reasonable sized thumnbail with a height of 240
                                int pixelH = bitmapFrame.PixelHeight;
                                int pixelW = bitmapFrame.PixelWidth;
                                int decodeH = 240;
                                int decodeW = (bitmapFrame.PixelWidth * decodeH) / pixelH;
                                double scaleX = decodeW / (double)pixelW;
                                double scaleY = decodeH / (double)pixelH;
                                TransformGroup transformGroup = new TransformGroup();
                                transformGroup.Children.Add(new ScaleTransform(scaleX, scaleY));
                                thumbnail.Transform = transformGroup;
                                thumbnail.EndInit();

                                // this will disconnect the stream from the image completely ...
                                WriteableBitmap writable = new WriteableBitmap(thumbnail);
                                writable.Freeze();
                                imageSource = writable;
                            }
                        }
                        else if (loadType == DisplayOptions.FullResolution)
                        {
                            BitmapImage bitmapImage = new BitmapImage();
                            bitmapImage.BeginInit();
                            bitmapImage.StreamSource = imageStream;
                            bitmapImage.EndInit();
                            imageSource = bitmapImage;
                        }
                    }
                    catch (Exception) { }
                }

                if (imageSource == null)
                {
                    image.Dispatcher.BeginInvoke(new ThreadStart(delegate
                    {
                        Loader.SetErrorDetected(image, true);
                    }));
                }
                else
                {
                    imageSource.Freeze();

                    image.Dispatcher.BeginInvoke(new ThreadStart(delegate
                    {
                        Loader.SetErrorDetected(image, false);
                    }));
                }
            }
            else
            {
                image.Dispatcher.BeginInvoke(new ThreadStart(delegate
                {
                    Loader.SetErrorDetected(image, false);
                }));
            }

            return imageSource;
        }
Beispiel #55
0
        private void WriteProperty(PropertyTarget target, DisplayOptions options, XmlWriter writer)
        {
            WriteProcedureName(target, writer);

            if ((options & DisplayOptions.ShowParameters) > 0)
            {
                IList <Parameter> parameters = target.Parameters;

                if (parameters.Count > 0)
                {
                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "languageSpecificText");
                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "cs");
                    writer.WriteString("[");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "vb");
                    writer.WriteString("(");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "cpp");
                    writer.WriteString("[");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "nu");
                    writer.WriteString("(");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "fs");
                    writer.WriteString(" ");
                    writer.WriteEndElement();

                    writer.WriteEndElement();

                    // show parameters
                    // we need to deal with type template substitutions!
                    for (int i = 0; i < parameters.Count; i++)
                    {
                        if (i > 0)
                        {
                            writer.WriteString(", ");
                        }

                        WriteType(parameters[i].ParameterType, DisplayOptions.Default, writer);
                    }

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "languageSpecificText");
                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "cs");
                    writer.WriteString("]");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "vb");
                    writer.WriteString(")");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "cpp");
                    writer.WriteString("]");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "nu");
                    writer.WriteString(")");
                    writer.WriteEndElement();

                    writer.WriteStartElement("span");
                    writer.WriteAttributeString("class", "fs");
                    writer.WriteString(" ");
                    writer.WriteEndElement();

                    writer.WriteEndElement();
                }
            }
        }
		protected void ShowForm(DisplayOptions options)
		{
			Visible = true;
			ReadOnlyView = options.ReadOnlyView;
			if (!IsHandleCreated)
			{
				// making a selection should help us get a handle created, if it's not already
				try
				{
					RootBox.MakeSimpleSel(true, true, false, true);
				}
				catch (COMException)
				{
					// We ignore failures since the text window may be empty, in which case making a
					// selection is impossible.
				}
			}
			else
			{
				CallLayout();
			}
			AutoScrollPosition = new Point(0, 0);
		}
Beispiel #57
0
 /// <summary>
 /// Write out a member target
 /// </summary>
 /// <param name="target">The member target information</param>
 /// <param name="options">The link display options</param>
 /// <param name="writer">The write to which the information is written</param>
 public void WriteMemberTarget(MemberTarget target, DisplayOptions options, XmlWriter writer)
 {
     WriteMemberTarget(target, options, writer, null);
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="SimpleRootSiteDataProvider_MultiStringViewVc"/> class.
		/// </summary>
		/// <param name="options">The options.</param>
		/// <param name="wsOrder">a list of writing systems in the order the strings should show in the view</param>
		public SimpleRootSiteDataProvider_MultiStringViewVc(DisplayOptions options, IList<int> wsOrder)
			: this(options)
		{
			WsOrder = wsOrder;
		}
Beispiel #59
0
        public string GenerateLink(LinkType type, int clientId, IEnumerable <int> groupIds, string redirectUri, DisplayOptions display, GroupPermissions scope, string state)
        {
            var sb  = new StringBuilder($"https://oauth.vk.com/authorize?client_id={clientId}");
            var uri = string.IsNullOrWhiteSpace(redirectUri) ? "https://oauth.vk.com/blank.html" : redirectUri;

            sb.Append($"&group_ids={string.Join(",", groupIds)}");
            sb.Append($"&scope={scope:D}");
            sb.Append($"&response_type={type.ToString().ToLower()}");
            sb.Append($"&v={RequestSettings.ApiVersion}");
            sb.Append($"&redirect_uri={uri}");

            if (display != DisplayOptions.Default)
            {
                sb.Append($"&display={display.ToString().ToLower()}");
            }

            if (!string.IsNullOrWhiteSpace(state))
            {
                sb.Append($"&state={state}");
            }

            return(sb.ToString());
        }