예제 #1
0
파일: Widget.cs 프로젝트: namit3/BlueMind
        public override void Serialize(XmlDocument dom, XmlElement node)
        {
            //
            node.SetAttribute("type", GetTypeID());
            node.SetAttribute("x", this.Bounds.X.ToString());
            node.SetAttribute("y", this.Bounds.Y.ToString());
            node.SetAttribute("width", this.Bounds.Width.ToString());
            node.SetAttribute("height", this.Bounds.Height.ToString());

            if (CustomWidth.HasValue)
            {
                node.SetAttribute("custom_width", CustomWidth.Value.ToString());
            }
            if (CustomHeight.HasValue)
            {
                node.SetAttribute("custom_height", CustomHeight.Value.ToString());
            }

            node.SetAttribute("align", Alignment.ToString());
            node.SetAttribute("hyperlink", Hyperlink);
            node.SetAttribute("display_index", DisplayIndex.ToString());
            node.SetAttribute("padding", Padding.ToString());
            if (!string.IsNullOrEmpty(Text))
            {
                ST.WriteTextNode(node, "text", Text);
            }
        }
예제 #2
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Label != null)
                {
                    hashCode = hashCode * 59 + Label.GetHashCode();
                }

                if (CategoryOrder != null)
                {
                    hashCode = hashCode * 59 + CategoryOrder.GetHashCode();
                }

                if (CategoryArray != null)
                {
                    hashCode = hashCode * 59 + CategoryArray.GetHashCode();
                }

                if (TickText != null)
                {
                    hashCode = hashCode * 59 + TickText.GetHashCode();
                }

                if (Values != null)
                {
                    hashCode = hashCode * 59 + Values.GetHashCode();
                }

                if (DisplayIndex != null)
                {
                    hashCode = hashCode * 59 + DisplayIndex.GetHashCode();
                }

                if (Visible != null)
                {
                    hashCode = hashCode * 59 + Visible.GetHashCode();
                }

                if (CategoryArraySrc != null)
                {
                    hashCode = hashCode * 59 + CategoryArraySrc.GetHashCode();
                }

                if (TickTextSrc != null)
                {
                    hashCode = hashCode * 59 + TickTextSrc.GetHashCode();
                }

                if (ValuesSrc != null)
                {
                    hashCode = hashCode * 59 + ValuesSrc.GetHashCode();
                }

                return(hashCode);
            }
        }
예제 #3
0
    public int CompareTo(DailyMissionModel other)
    {
        if (other == null)
        {
            return(1);
        }

        return(DisplayIndex.CompareTo(other.DisplayIndex));
    }
예제 #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (DisplayIndex < QueryResult.Count - 1)
     {
         DisplayIndex++;
         DisplaySituation();
     }
     counterLabel.Text = DisplayIndex.ToString() + "/" + QueryResult.Count.ToString();
 }
예제 #5
0
 //Buttons 1 and 2 are for seeing next/prev suggestion
 private void button1_Click(object sender, System.EventArgs e)
 {
     if (DisplayIndex > 0)
     {
         DisplayIndex--;
         DisplaySituation();
     }
     counterLabel.Text = DisplayIndex.ToString() + "/" + QueryResult.Count.ToString();
 }
예제 #6
0
 // Gets the DisplayDevice that corresponds to the specified index.
 public virtual DisplayDevice GetDisplay(DisplayIndex index)
 {
     if (index == DisplayIndex.Primary)
         return Primary;
     else if ((int)index >= 0 && (int)index < AvailableDevices.Count)
         return AvailableDevices[(int)index];
     else
         return null;
 }
예제 #7
0
 public virtual DisplayDevice GetDisplay(DisplayIndex index)
 {
     if (index == DisplayIndex.Primary)
     return this.Primary;
       if (index >= DisplayIndex.First && index < (DisplayIndex) this.AvailableDevices.Count)
     return this.AvailableDevices[(int) index];
       else
     return (DisplayDevice) null;
 }
예제 #8
0
    public int CompareTo(AchievementGroupModel other)
    {
        if (other == null)
        {
            return(1);
        }

        return(DisplayIndex.CompareTo(other.DisplayIndex));
    }
예제 #9
0
    public override string ToString()
    {
        StringBuilder overRideString = new StringBuilder();

        overRideString.AppendLine("DisplayIndex" + DisplayIndex.ToString());
        overRideString.AppendLine("Width" + Width.ToString());
        overRideString.AppendLine("Visible" + Visible.ToString());
        overRideString.AppendLine("ColumnIndex" + ColumnIndex.ToString());
        return(overRideString.ToString());
    }
예제 #10
0
 private void UpdateDisplayBounds()
 {
     bounds = Rectangle.Empty;
     for (DisplayIndex i = DisplayIndex.First; i < DisplayIndex.Sixth; i++)
     {
         DisplayDevice display = DisplayDevice.GetDisplay(i);
         if (display != null)
         {
             bounds = Rectangle.Union(bounds, display.Bounds);
         }
     }
 }
예제 #11
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public int CompareTo(cListViewColumn Column)
        {
            if (Column == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Compare Display Index
            //----------------------------------------------------------------------------*

            return(DisplayIndex.CompareTo(Column.DisplayIndex));
        }
예제 #12
0
        // Gets the DisplayDevice that corresponds to the specified index.
        public virtual DisplayDevice GetDisplay(DisplayIndex index)
        {
            if (index == DisplayIndex.Primary)
            {
                return(Primary);
            }

            if ((int)index >= 0 && (int)index < AvailableDevices.Count)
            {
                return(AvailableDevices[(int)index]);
            }

            return(null);
        }
예제 #13
0
        public static DisplayDevice GetDisplay(DisplayIndex index)
        {
            if (index == DisplayIndex.Default)
            {
                return(Default);
            }
            var screens = NSScreen.Screens;

            if ((int)index < 0 || (int)index >= screens.Length)
            {
                return(null);
            }
            return(new DisplayDevice(GetScreenBounds(screens[(int)index])));
        }
예제 #14
0
 public static DisplayDevice FromPoint(int x, int y)
 {
     for (DisplayIndex i = DisplayIndex.First; i < DisplayIndex.Sixth; i++)
     {
         DisplayDevice display = DisplayDevice.GetDisplay(i);
         if (display != null)
         {
             if (display.Bounds.Contains(x, y))
             {
                 return(display);
             }
         }
     }
     return(null);
 }
예제 #15
0
 public virtual DisplayDevice GetDisplay(DisplayIndex index)
 {
     if (index == DisplayIndex.Primary)
     {
         return(this.Primary);
     }
     if (index >= DisplayIndex.First && index < (DisplayIndex)this.AvailableDevices.Count)
     {
         return(this.AvailableDevices[(int)index]);
     }
     else
     {
         return((DisplayDevice)null);
     }
 }
예제 #16
0
 public IScreen FromPoint(int x, int y)
 {
     for (DisplayIndex i = DisplayIndex.First; i < DisplayIndex.Sixth; i++)
     {
         var display = this[(int)i];
         if (display != null)
         {
             if (display.Bounds.Has(x, y))
             {
                 return display;
             }
         }
     }
     return null;
 }
예제 #17
0
        static void Main(string[] args)
        {
            int[] arr = { 5, 2, 8, 1, -8 };
            // HP 1
            DisplayIndex d1 = Program.Index;

            d1(arr, 1);

            // HP 2
            DisplayElements d2 = Program.Display;

            d2(arr);

            // HP 3
            AddExample d3 = Program.getMessage1;

            d3 += getMessage2;
            Console.WriteLine($"\nAdd Delegate Returned: {d3()}");

            // HP 4
            SortAndDisplay d4 = delegate(int[] arr){
                for (int i = 0; i < arr.Length; i++)
                {
                    for (int j = 0; j < arr.Length - i - 1; j++)
                    {
                        if (arr[j] > arr[j + 1])
                        {
                            arr[j] ^= arr[j + 1]; arr[j + 1] ^= arr[j]; arr[j] ^= arr[j + 1];
                        }
                    }
                }
                Console.Write("Sorted Array: ");
                foreach (int i in arr)
                {
                    Console.Write(i + " ");
                }
                Console.Write("\n");
            };

            d4(arr);

            // HP 5
            Console.WriteLine($"Found -7 in array: {Temp.Search(arr, -7)}");
        }
예제 #18
0
        public void DisplaySituation()
        {
            CurrentSituation.Clear();
            List <int> temp = new List <int>();

            if (QueryResult != null && QueryResult.Count != 0)
            {
                counterLabel.Text = DisplayIndex.ToString() + "/" + QueryResult.Count.ToString();
                foreach (var list in QueryResult[DisplayIndex])
                {
                    temp.AddRange(list);
                }
                //temp.Add();
                //temp.Add(temp.Min() - 2);
                //temp.Add(temp.Max() + 1);
                //temp.Add(temp.Max() + 2);
                ////bleh
                temp.Sort();
                Hits = temp;
                CurrentSituation.Add(LuceneService.RetrieveMessageById(temp.Min() - 2));
                CurrentSituation.Add(LuceneService.RetrieveMessageById(temp.Min() - 1));

                for (int i = temp[0]; i <= temp[temp.Count - 1]; i++)
                {
                    CurrentSituation.Add(LuceneService.RetrieveMessageById(i));
                }
                CurrentSituation.Add(LuceneService.RetrieveMessageById(temp.Max() + 1));
                CurrentSituation.Add(LuceneService.RetrieveMessageById(temp.Max() + 2));

                suggesterView.SetObjects(CurrentSituation);
                SetUpChatView();
                suggesterView.Sort(suggesterView.AllColumns.Find(x => x.Text.Equals(ProjectInfo.DateFieldKey)), SortOrder.Ascending);
            }
            if (QueryResult == null)
            {
                MessageBox.Show("Incorrect query");
            }
            if (QueryResult != null && QueryResult.Count == 0)
            {
                MessageBox.Show("Nothing found");
            }
        }
예제 #19
0
        public Dictionary <string, string> ToDictionary()
        {
            var msg = new Dictionary <string, string> {
                { "displayEnabled", DisplayEnabled ? "true" : "false" },
                { "firstboot", FirstBoot ? "true" : "false" },
                { "displayIndex", DisplayIndex.ToString() },
                { "hwselftest", HwSelfTest ? "true" : "false" }
            };

            for (var i = 0; i < BusConfig.Length; i++)
            {
                msg.Add("Bus " + (i + 1) + " config", BusConfig[i].ToString());
            }
            for (var i = 0; i < Pid.Length; i++)
            {
                msg.Add("PID " + (i + 1), Pid[i].ToString());
            }

            return(msg);
        }
예제 #20
0
        public int CompareTo(ColumnProperty rhs)
        {
            int result = Name.CompareTo(rhs.Name);

            if (result != 0)
            {
                return(result);
            }
            result = Index.CompareTo(rhs.Index);
            if (result != 0)
            {
                return(result);
            }
            result = DisplayIndex.CompareTo(rhs.DisplayIndex);
            if (result != 0)
            {
                return(result);
            }
            result = Type.Name.CompareTo(rhs.Type.Name);
            if (result != 0)
            {
                return(result);
            }
            result = (Precision ?? 0).CompareTo(rhs.Precision ?? 0);
            if (result != 0)
            {
                return(result);
            }
            result = (Visible ?? false).CompareTo(rhs.Visible ?? false);
            if (result != 0)
            {
                return(result);
            }
            result = (ForeColor ?? Color.Black).ToArgb().CompareTo((rhs.ForeColor ?? Color.Black).ToArgb());
            if (result != 0)
            {
                return(result);
            }
            return((BackColor ?? Color.Black).ToArgb().CompareTo((rhs.BackColor ?? Color.Black).ToArgb()));
        }
예제 #21
0
        private void SetCenteredFullScreenWindow(Point position)
        {
            int          x       = position.X;
            int          actualX = 0;
            Size         size    = default(Size);
            DisplayIndex index   = DisplayIndex.Default;

            while (x >= 0)
            {
                var display = DisplayDevice.GetDisplay(index);
                x -= display.Width;
                if (x > 0)
                {
                    actualX += display.Width;
                }
                else
                {
                    size = new Size(display.Width, display.Height);
                }

                index += 1;
            }

            if (size == default(Size))
            {
                throw new InvalidOperationException("SetCenteredFullScreen failed. Couldn't determine size.");
            }

            var bounds = _nativeWindow.Bounds;

            bounds.X             = actualX;
            bounds.Y             = 0;
            bounds.Width         = size.Width;
            bounds.Height        = size.Height;
            _nativeWindow.Bounds = bounds;
        }
예제 #22
0
 public static DisplayDevice GetDisplay(DisplayIndex index)
 {
   return DisplayDevice.implementation.GetDisplay(index);
 }
예제 #23
0
 public DisplayDevice GetDisplay(DisplayIndex displayIndex)
 {
     return((displayIndex == DisplayIndex.First || displayIndex == DisplayIndex.Primary) ? dev : null);
 }
예제 #24
0
 public DisplayDevice GetDisplay(DisplayIndex displayIndex) =>
 (displayIndex == DisplayIndex.First || displayIndex == DisplayIndex.Primary) ? dev : null;
예제 #25
0
 /// <summary>
 /// Gets the <see cref="DisplayDevice"/> for the specified <see cref="DisplayIndex"/>.
 /// </summary>
 /// <param name="index">The <see cref="DisplayIndex"/> that defines the desired display.</param>
 /// <returns>A <see cref="DisplayDevice"/> or null, if no device corresponds to the specified index.</returns>
 public static DisplayDevice GetDisplay(DisplayIndex index)
 {
     return(implementation.GetDisplay(index));
 }
예제 #26
0
 private void windowDisplayIndexChanged(DisplayIndex index) => CurrentDisplay = DisplayDevice.GetDisplay(index);
예제 #27
0
        public bool Equals([AllowNull] Dimension other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Label == other.Label && Label != null && other.Label != null && Label.Equals(other.Label)) &&
                   (CategoryOrder == other.CategoryOrder && CategoryOrder != null && other.CategoryOrder != null && CategoryOrder.Equals(other.CategoryOrder)) &&
                   (Equals(CategoryArray, other.CategoryArray) || CategoryArray != null && other.CategoryArray != null && CategoryArray.SequenceEqual(other.CategoryArray)) &&
                   (Equals(TickText, other.TickText) || TickText != null && other.TickText != null && TickText.SequenceEqual(other.TickText)) &&
                   (Equals(Values, other.Values) || Values != null && other.Values != null && Values.SequenceEqual(other.Values)) &&
                   (DisplayIndex == other.DisplayIndex && DisplayIndex != null && other.DisplayIndex != null && DisplayIndex.Equals(other.DisplayIndex)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (CategoryArraySrc == other.CategoryArraySrc && CategoryArraySrc != null && other.CategoryArraySrc != null && CategoryArraySrc.Equals(other.CategoryArraySrc)) &&
                   (TickTextSrc == other.TickTextSrc && TickTextSrc != null && other.TickTextSrc != null && TickTextSrc.Equals(other.TickTextSrc)) &&
                   (ValuesSrc == other.ValuesSrc && ValuesSrc != null && other.ValuesSrc != null && ValuesSrc.Equals(other.ValuesSrc)));
        }