private void ProductWindowLoaded(object sender, RoutedEventArgs e)
        {
            ResourceDictionary resource = new ResourceDictionary()
            {
                Source = new Uri("view\\products\\ReadonlyProductDictionary.xaml", UriKind.Relative)
            };

            View.Resources.MergedDictionaries.Clear();
            View.Resources.MergedDictionaries.Add(resource);


            foreach (var textBox in ChildFinder.FindVisualChildren <TextBox>(View))
            {
                textBox.Style = resource["BoxStyle"] as Style;
                if (textBox.Text.Length == 0)
                {
                    textBox.Text = "-";
                }
            }
            foreach (var comboBox in ChildFinder.FindVisualChildren <ComboBox>(View))
            {
                comboBox.Visibility = Visibility.Collapsed;
            }
            foreach (var textblock in ChildFinder.FindVisualChildren <TextBlock>(View))
            {
                textblock.Visibility = Visibility.Visible;
            }
            foreach (var button in ChildFinder.FindVisualChildren <Button>(View))
            {
                button.Visibility = Visibility.Collapsed;
            }
        }
 private void TreeItemExecute(object sender, RoutedEventArgs e)
 {
     foreach (var item in ChildFinder.FindVisualChildren <TreeViewItem>(AdminMenu))
     {
         item.IsSelected = false;
     }
     (DataContext as MainWindowViewModel).TreeItemExecute();
 }
示例#3
0
        public void Open()
        {
            if (this._splitmenu == null)
            {
                this._splitmenu = ChildFinder.FindChild <SplitView>(Window.Current.Content, "panel_splitter");
            }

            this._splitmenu.IsPaneOpen = !this._splitmenu.IsPaneOpen;
        }
        private void AdminToolsSelectedItemChanged(object sender, RoutedEventArgs e)
        {
            foreach (var item in ChildFinder.FindVisualChildren <TreeViewItem>(Tree))
            {
                item.IsSelected = false;
            }
            string tool = (sender as TreeViewItem).Header.ToString();

            (DataContext as MainWindowViewModel).SelectAdminTool(tool);
        }
示例#5
0
        /// <summary>
        /// Finds a child control and returns its handle as AWnd.
        /// </summary>
        /// <returns>Returns <c>default(AWnd)</c> if not found. See also: <see cref="Is0"/>, <see cref="operator +(AWnd)"/>.</returns>
        /// <param name="name">
        /// Control name.
        /// String format: [](xref:wildcard_expression).
        /// null means 'can be any'. "" means 'no name'.
        ///
        /// By default to get control names this function uses <see cref="Name"/>.
        /// Can start with these prefix strings:
        /// - <c>"***text "</c> - use <see cref="ControlText"/>. Slower and less reliable because can get editable text. If a character can be underlined with Alt, insert '&amp;' before it.
        /// - <c>"***accName "</c> - use <see cref="NameAcc"/>. Slower.
        /// - <c>"***wfName "</c> - use .NET Forms control name (see <see cref="AWinFormsControlNames"/>). Slower and can fail because of [](xref:uac).
        /// - <c>"***id "</c> like <c>"***id 15"</c> - use control id (<see cref="ControlId"/>). See also <see cref="ChildById"/>.
        /// </param>
        /// <param name="cn">
        /// Control class name.
        /// String format: [](xref:wildcard_expression).
        /// null means 'can be any'. Cannot be "".
        /// </param>
        /// <param name="flags"></param>
        /// <param name="also">
        /// Callback function. Called for each matching control.
        /// It can evaluate more properties of the control and return true when they match.
        /// Example: <c>also: t =&gt; t.IsEnabled</c>
        /// </param>
        /// <param name="skip">
        /// 0-based index of matching control.
        /// For example, if 1, the function skips the first matching control and returns the second.
        /// </param>
        /// <exception cref="AuWndException">This variable is invalid (window not found, closed, etc).</exception>
        /// <exception cref="ArgumentException">
        /// - <i>name</i> starts with <c>"***"</c>, but the prefix is invalid.
        /// - <i>cn</i> is "". To match any, use null.
        /// - Invalid wildcard expression (<c>"**options "</c> or regular expression).
        /// </exception>
        /// <remarks>
        /// To create code for this function, use dialog "Find window or control". It is form <b>Au.Tools.FormAWnd</b> in Au.Tools.dll.
        /// </remarks>
        public AWnd Child(
            [ParamString(PSFormat.AWildex)] string name = null,
            [ParamString(PSFormat.AWildex)] string cn   = null,
            WCFlags flags = 0, Func <AWnd, bool> also = null, int skip = 0)
        {
            //ThrowIfInvalid(); //will be called later
            var f = new ChildFinder(name, cn, flags, also, skip);

            f.Find(this);
            return(f.Result);
        }
示例#6
0
        private static List <ParameterExpression> FindParameters(MethodCallExpression methodCallExpression)
        {
            var finder = new ChildFinder <ParameterExpression>();

            if (!methodCallExpression.Method.IsStatic)
            {
                finder.Visit(methodCallExpression.Object);
            }

            foreach (var argument in methodCallExpression.Arguments)
            {
                finder.Visit(argument);
            }

            return(finder.FoundChildren.Distinct().ToList());
        }
    // Use this for initialization
    void Start()
    {
        //We need to find our compononents attached to the player
        playerNameText = ChildFinder.FindChildByName(transform, PlayerNameTextName).gameObject;
        PlayerName     = playerName;            //Set the player name
        playerModel    = ChildFinder.FindChildByName(transform, PlayerModelName).gameObject;
        mainCamera     = FindMainCamera();

        //Add our components and put them on our variables
        playerNetworkerScript = gameObject.AddComponent <PlayerNetworker>();

        //We need to check if we are a network player before adding these
        if (playerNetworkerScript.IsLocalPlayer)
        {
            //Add this to our player
            playerCameraScript = gameObject.AddComponent <PlayerCamera>();
            playerCameraScript.Initialize(new MurderCameraSetup());             //Set the camera to the murder camera setup
            Debug.Log("Another test commit");
            playerMoveScript = gameObject.AddComponent <PlayerMove>();
        }
    }
示例#8
0
        public void UpdateButtons()
        {
            Order order = MainVM.Customer.Order.FirstOrDefault(ord => ord.State == State.Created);

            if (order != null)
            {
                if (MainVM.Customer.Role == model.enums.Role.User)
                {
                    foreach (Button button in ChildFinder.FindVisualChildren <Button>(View.ProductList))
                    {
                        if (order.Ordered.FirstOrDefault(ord => ord.Product.Id == ((Product)button.DataContext).Id) != null && MainVM.Customer.Role == model.enums.Role.User)
                        {
                            button.IsEnabled = false;
                            button.Content   = "В корзине";
                        }
                        else if (((Product)button.DataContext).Amount <= 0)
                        {
                            button.IsEnabled = false;
                            button.Content   = "Нет на складе";
                        }
                        else
                        {
                            button.IsEnabled = true;
                            button.Content   = "В корзину";
                        }
                    }
                }
                else
                {
                    foreach (Button button in ChildFinder.FindVisualChildren <Button>(View.ProductList))
                    {
                        button.Visibility = Visibility.Collapsed;
                    }
                }
            }
        }
示例#9
0
        /// <summary>
        /// Gets the children of this window, if any.
        /// <remarks>These windows will probably not be top-level windows.</remarks>
        /// </summary>
        /// <value>The child Windows</value>
        public static List <WindowHandle> GetChildren(this WindowHandle wnd)
        {
            ChildFinder cf = new ChildFinder(wnd);

            return((List <WindowHandle>)cf.FindAll());
        }
示例#10
0
 private CommandBar GetBar()
 {
     return(this._commandBar ??
            ChildFinder.FindChild <CommandBar>(Window.Current.Content, "mainCommandBar"));
 }