コード例 #1
0
        /// <summary>
        /// Returns true if ValueMappingElement instances are equal
        /// </summary>
        /// <param name="other">Instance of ValueMappingElement to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ValueMappingElement other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     DisplayElements == other.DisplayElements ||
                     DisplayElements != null &&
                     DisplayElements.SequenceEqual(other.DisplayElements)
                     ) &&
                 (
                     DisplayName == other.DisplayName ||
                     DisplayName != null &&
                     DisplayName.Equals(other.DisplayName)
                 ) &&
                 (
                     Value == other.Value ||
                     Value != null &&
                     Value.Equals(other.Value)
                 ));
        }
コード例 #2
0
        private void MoveUp()
        {
            var currentDisplayElement = CurrentDisplayElement;
            var index = DisplayElements.IndexOf(currentDisplayElement);

            DisplayElements.Move(index, index - 1);
        }
コード例 #3
0
        public static void Quick_Sort(int[] args)
        {
            int size = args.Length;

            Sort(args, size);

            Console.WriteLine("QuickSort Sorted: ");
            DisplayElements.ShowElements(args, size);
        }
コード例 #4
0
 public void SetDisplayElement(DisplayElements element, bool state)
 {
     if (state)
     {
         DisplayElement = DisplayElement | (int)element;
     }
     else
     {
         DisplayElement = DisplayElement & (~(int)element);
     }
 }
コード例 #5
0
        private void ContentTakeOver_Click(object sender, RoutedEventArgs e)
        {
            var x = DisplayElements.SelectedItem;

            if (x != null && x is VisualElementGeneric)
            {
                x.RefreshFromMainData();
            }
            DisplayElements.Refresh();
            ContentTakeOver.IsEnabled = false;
        }
コード例 #6
0
        public static void Merge_Sort(int[] args)
        {
            int size = args.Length;

            Sort(args, size);
            Console.WriteLine();

            Console.WriteLine("Sorted array is : ");
            DisplayElements.ShowElements(args, size);
            Console.WriteLine("Speed: ");
            Console.ReadLine();
        }
コード例 #7
0
        public void StartProgram(string[] args)
        {
            Validator       validator   = new Validator();
            DisplayElements displayText = new DisplayElements();

            if (validator.TryParsing(args[0]) && validator.TryParsing(args[1]))
            {
                Fibonacci fibonacci = new Fibonacci(long.Parse(args[0]), long.Parse(args[1]));
                foreach (long num in fibonacci)
                {
                    displayText.DisplayNumbers(num.ToString());
                }
            }
            else
            {
                displayText.DisplayNumbers("Numbers aren`t validated!");
            }
        }
コード例 #8
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)}");
        }
コード例 #9
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (DisplayElements != null)
         {
             hashCode = hashCode * 59 + DisplayElements.GetHashCode();
         }
         if (DisplayName != null)
         {
             hashCode = hashCode * 59 + DisplayName.GetHashCode();
         }
         if (Value != null)
         {
             hashCode = hashCode * 59 + Value.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #10
0
        public void RedrawAllAasxElements()
        {
            var t = "AASX Package Explorer";

            if (thePackageEnv != null)
            {
                t += " - " + System.IO.Path.GetFileName(thePackageEnv.Filename);
            }
            if (thePackageAux != null)
            {
                t += " (auxiliary AASX: " + System.IO.Path.GetFileName(thePackageAux.Filename) + ")";
            }
            this.Title = t;

            // clear the right section, first (might be rebuild by callback from below)
            DispEditEntityPanel.DisplayClear();
            ContentTakeOver.IsEnabled = false;

            // rebuild middle section
            DisplayElements.RebuildAasxElements(this.thePackageEnv.AasEnv, this.thePackageEnv, null, MenuItemWorkspaceEdit.IsChecked);
            DisplayElements.Refresh();
        }
コード例 #11
0
        static void Main(string[] args)
        {
            int i, size;

            Console.Write("Enter the size of elements: ");
            size = Convert.ToInt32(Console.ReadLine());
            int[] a = new int[size];
            Random rand = new Random();
            for (i = 0; i < size; i++)
                a[i] = rand.Next(100, 999);

            Console.WriteLine("Original array: ");
            DisplayElements.ShowElements(a, size);
            Console.WriteLine();

            Console.WriteLine("Starting comparsion...");

            BubbleSort.Bubble_Sort(a);
            HeapSort.Heap_Sort(a);
            //InsertionSort(a);
            MergeSort.Merge_Sort(a);
            QuickSort.Quick_Sort(a);
               // SelectionSort(a);
        }
コード例 #12
0
        //
        // Callbacks
        //

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // making up "empty" picture
            this.AasId.Text   = "<id unknown!>";
            this.AssetId.Text = "<id unknown!>";

            /*
             * Image image = new Image();
             * image.Source = new BitmapImage(new Uri("Resources/USB_Hexagon_offen.jpeg", UriKind.RelativeOrAbsolute));
             * this.AssetPic.Source = new BitmapImage(new Uri("Resources/USB_Hexagon_offen.jpeg", UriKind.RelativeOrAbsolute));
             */

            // display elements has a cache
            DisplayElements.ActivateElementStateCache();

            // show Logo?
            if (Options.LogoFile != null)
            {
                try
                {
                    var bi = new BitmapImage(new Uri(Options.LogoFile, UriKind.RelativeOrAbsolute));
                    this.LogoImage.Source = bi;
                    this.LogoImage.UpdateLayout();
                } catch { }
            }

            // adding the CEF Browser conditionally
#if WITHOUTCEF
            theBrowser         = new FakeBrowser();
            CefContainer.Child = theBrowser;
            theBrowser.Address = "https://github.com/admin-shell/io/blob/master/README.md";
#else
            theBrowser         = new CefSharp.Wpf.ChromiumWebBrowser();
            CefContainer.Child = theBrowser;
            theBrowser.Address = "https://github.com/admin-shell/io/blob/master/README.md";
#endif

            // window size?
            if (Options.WindowLeft > 0)
            {
                this.Left = Options.WindowLeft;
            }
            if (Options.WindowTop > 0)
            {
                this.Top = Options.WindowTop;
            }
            if (Options.WindowWidth > 0)
            {
                this.Width = Options.WindowWidth;
            }
            if (Options.WindowHeight > 0)
            {
                this.Height = Options.WindowHeight;
            }
            if (Options.WindowMaximized)
            {
                this.WindowState = WindowState.Maximized;
            }

            // Timer for below
            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            dispatcherTimer.Start();

            // Last task here ..
            Log.Info("Application started ..");

            // Try to load?
            if (Options.AasxToLoad != null)
            {
                // make a fully qualified filename from that one provided as input argument
                var fn = System.IO.Path.GetFullPath(Options.AasxToLoad);
                UiLoadPackageEnv(fn);
            }

            // test sequence

            /*
             * var asset1 = new AdminShell.Asset();
             * Log.Info("asset1" + asset1.GetElementName());
             * AdminShell.Referable ref1 = asset1;
             * Log.Info("ref1" + ref1.GetElementName());
             * var s = Options.GenerateIdAccordingTemplate(Options.TemplateIdSubmodelType);
             */

            /*
             * var blur = new BlurEffect();
             * blur.Radius = 5;
             *
             * var current = this.Background;
             * this.Background = new SolidColorBrush(Colors.DarkGray);
             * this.Effect = blur;
             * MessageBox.Show("hello");
             * this.Effect = null;
             * this.Background = current;
             * this.InnerGrid.Opacity = 0.5;
             * this.InnerGrid.Effect = blur;
             */
        }
コード例 #13
0
 private void FilterFor(string filter)
 {
     filter = ApplyFullFilterString(filter);
     DisplayElements.RebuildAasxElements(packages, DiaData.Selector, true, filter,
                                         lazyLoadingFirst: true);
 }
コード例 #14
0
 public void ToggleDisplayElement(DisplayElements element)
 {
     SetDisplayElement(element, !GetDisplayElement(element));
 }
コード例 #15
0
 public bool GetDisplayElement(DisplayElements element)
 {
     return((m_DisplayElements & (int)element) != 0);
 }
コード例 #16
0
 private void FilterFor(string filter)
 {
     filter = ApplyFullFilterString(filter);
     DisplayElements.RebuildAasxElements(theEnv, thePackage, theAuxPackages, true, filter);
 }
コード例 #17
0
        private bool CanMoveDown()
        {
            var currentDisplayElement = CurrentDisplayElement;

            return(currentDisplayElement != null && DisplayElements.IndexOf(currentDisplayElement) != DisplayElements.Count - 1);
        }
コード例 #18
0
 private void FilterFor(string filter)
 {
     filter = ApplyFullFilterString(filter);
     DisplayElements.RebuildAasxElements(packages, selector, true, filter);
 }
コード例 #19
0
        private void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            // check for Stored Prints in Log
            if (Log.StoredPrints.Count > 0)
            {
                var sp = Log.StoredPrints.Last();
                Message.Content = "" + sp.msg;
                if (sp.color == Log.ColorBlack)
                {
                    Message.Background = Brushes.White;
                }
                if (sp.color == Log.ColorBlue)
                {
                    Message.Background = Brushes.LightBlue;
                }
                if (sp.color == Log.ColorRed)
                {
                    Message.Background = Brushes.Red;
                }
            }

            // check if Display/ Edit Control has some work to do ..
            try
            {
                if (DispEditEntityPanel != null && DispEditEntityPanel.WishForOutsideAction != null)
                {
                    while (DispEditEntityPanel.WishForOutsideAction.Count > 0)
                    {
                        var temp = DispEditEntityPanel.WishForOutsideAction[0];
                        DispEditEntityPanel.WishForOutsideAction.RemoveAt(0);

                        // what to do?
                        if (temp is ModifyRepo.LambdaActionRedrawAllElements)
                        {
                            var wish = temp as ModifyRepo.LambdaActionRedrawAllElements;
                            // edit mode affects the total element view
                            RedrawAllAasxElements();
                            // the selection will be shifted ..
                            if (wish.NextFocus != null)
                            {
                                var si = DisplayElements.SearchVisualElementOnMainDataObject(wish.NextFocus);
                                if (si != null)
                                {
                                    si.IsSelected = true;
                                    if (wish.IsExpanded == true)
                                    {
                                        // go upward the tree in order to expand, as well
                                        var sii = si;
                                        while (sii != null)
                                        {
                                            sii.IsExpanded = wish.IsExpanded == true;
                                            sii            = sii.Parent;
                                        }
                                    }
                                    if (wish.IsExpanded == false)
                                    {
                                        si.IsExpanded = wish.IsExpanded == true;
                                    }
                                    DisplayElements.Woodoo(si);
                                }
                            }
                            // fake selection
                            RedrawElementView();
                            DisplayElements.Refresh();
                            ContentTakeOver.IsEnabled = false;
                        }

                        if (temp is ModifyRepo.LambdaActionContentsChanged)
                        {
                            // enable button
                            ContentTakeOver.IsEnabled = true;
                        }

                        if (temp is ModifyRepo.LambdaActionContentsTakeOver)
                        {
                            // rework list
                            ContentTakeOver_Click(null, null);
                        }
                    }
                }
            } catch (Exception ex) {
                Log.Error(ex, "While responding to a user interaction");
            }
        }
コード例 #20
0
        private bool CanMoveUp()
        {
            var currentDisplayElement = CurrentDisplayElement;

            return(currentDisplayElement != null && DisplayElements.IndexOf(currentDisplayElement) != 0);
        }