示例#1
0
        /// <summary>
        /// The animated expender_ expanded.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void AnimatedExpenderExpanded(object sender, RoutedEventArgs e)
        {
            Expander ex = sender as Expander;

            if (ex != null && ex.Parent.GetType().Name == typeof(WrapPanel).Name)
            {
                WrapPanel wr = ex.Parent as WrapPanel;
                if (wr != null)
                {
                    foreach (var exP in wr.Children)
                    {
                        Expander wEx = exP as Expander;
                        if (wEx != null && (!wEx.Equals(ex) && wEx.IsExpanded))
                        {
                            wEx.IsExpanded = false;
                        }
                    }

                    if (wr.Equals(this.WpServers))
                    {
                        if (this.ExSelf.IsExpanded)
                        {
                            this.ExUsernameAndPass.IsEnabled = false;
                            if (!this.ExOpen.IsExpanded)
                            {
                                this.ExOpen.IsExpanded = true;
                            }
                        }
                        else if (this.ExServer.IsExpanded)
                        {
                            this.ExUsernameAndPass.IsEnabled = true;
                        }
                        else if (this.ExWeb.IsExpanded)
                        {
                            this.ExUsernameAndPass.IsEnabled = true;
                        }
                        else if (this.ExProxy.IsExpanded)
                        {
                            this.ExUsernameAndPass.IsEnabled = true;
                        }
                    }
                }
            }

            if (ex == null || ex.Content == null)
            {
                return;
            }

            DoubleAnimation animation = new DoubleAnimation(
                25,
                ((Grid)ex.Content).Height + 25,
                new Duration(TimeSpan.FromSeconds(0.4)));

            ex.BeginAnimation(HeightProperty, animation);

            this.SaveSettings();
        }
        /// <summary>
        /// Looks if File Exists When not it expands additional info
        /// </summary>
        private void AnimateAndCheck()
        {
            if (IsAdmin.Equals(0))
            {
                return;                    //returns if user is not an admin
            }
            Expander ex = NewWeekExpander;

            if (WeekNrTextBox.Text != "" && File.Exists(@"Data\" + WeekNrTextBox.Text + @".week") ||
                WeekNrTextBox.Text == "")
            {
                DoubleAnimation animation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.5));

                ex.BeginAnimation(OpacityProperty, animation);
            }
            else
            {
                DoubleAnimation animation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.5));

                NewWeekExpander.IsExpanded = true;

                ex.BeginAnimation(OpacityProperty, animation);
            }
        }
示例#3
0
        /// <summary>
        /// Looks if File Exists When not it expands additional info
        /// </summary>
        private void AnimateAndCheck()
        {
            if (File.Exists(@"Data\" + WeekNrTextBox.Text + @".week") && WeekNrTextBox.Text != "" ||
                WeekNrTextBox.Text == "")
            {
                Expander        ex        = NewWeekExpander;
                DoubleAnimation animation = new DoubleAnimation(0, TimeSpan.FromSeconds(0.5));

                ex.BeginAnimation(OpacityProperty, animation);
            }
            else
            {
                Expander        ex        = NewWeekExpander;
                DoubleAnimation animation = new DoubleAnimation(1, TimeSpan.FromSeconds(0.5));

                NewWeekExpander.IsExpanded = true;

                ex.BeginAnimation(OpacityProperty, animation);
            }
        }
示例#4
0
        /// <summary>
        /// The animated expender_ collapsed.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void AnimatedExpenderCollapsed(object sender, RoutedEventArgs e)
        {
            Expander ex = sender as Expander;

            if (ex != null && ex.Parent.GetType().Name == typeof(WrapPanel).Name)
            {
                WrapPanel wr         = ex.Parent as WrapPanel;
                bool      onIsEnable = false;
                if (wr != null)
                {
                    foreach (var exP in wr.Children)
                    {
                        Expander wEx = exP as Expander;
                        if (wEx != null && (!wEx.Equals(ex) && wEx.IsExpanded))
                        {
                            onIsEnable = true;
                        }
                    }
                }

                if (!onIsEnable)
                {
                    ex.IsExpanded = true;
                    return;
                }
            }

            if (ex == null || ex.Content == null)
            {
                return;
            }

            DoubleAnimation animation = new DoubleAnimation(
                ((Grid)ex.Content).Height + 25,
                25,
                new Duration(TimeSpan.FromSeconds(0.2)));

            ex.BeginAnimation(HeightProperty, animation);
        }