Beispiel #1
0
        internal void Drop(object sender, DragEventArgs e)
        {
            System.Windows.Controls.TabItem tabItemTarget = null;
            if (e.Source is System.Windows.Controls.TabItem)
            {
                tabItemTarget = e.Source as System.Windows.Controls.TabItem;
            }
            else if (e.Source is TextBlock)
            {
                TextBlock  k      = e.Source as TextBlock;
                StackPanel Target = k.Parent as StackPanel;
                tabItemTarget = Target.Parent as System.Windows.Controls.TabItem;
            }
            else if (e.Source is Image)
            {
                Image      k      = e.Source as Image;
                StackPanel Target = k.Parent as StackPanel;
                tabItemTarget = Target.Parent as System.Windows.Controls.TabItem;
            }
            else
            {
                return;
            }
            var tabItemSource = e.Data.GetData(typeof(System.Windows.Controls.TabItem)) as System.Windows.Controls.TabItem;

            if (!tabItemTarget.Equals(tabItemSource))
            {
                var tabControl  = tabItemTarget.Parent as TabControl;
                int sourceIndex = tabControl.Items.IndexOf(tabItemSource);
                int targetIndex = tabControl.Items.IndexOf(tabItemTarget);

                tabControl.Items.Remove(tabItemSource);
                tabControl.Items.Insert(targetIndex, tabItemSource);

                tabControl.Items.Remove(tabItemTarget);
                tabControl.Items.Insert(sourceIndex, tabItemTarget);
            }
        }
        public void Navigate(TabItem ti)
        {
            if (_lastPage is Marble)
            {
                foreach (Process p in Process.GetProcessesByName("marble"))
                {
                    p.Kill();
                }
            }

            Frame f = new Frame();

            if (ti.Equals(_weightTab))
            {
                navigateWeight(f);
            }
            else if (ti.Equals(_movementTab))
            {
                navigateMovement(f);
            }
            else if (ti.Equals(_cogTab))
            {
                navigateCOG(f);
            }
            else if (ti.Equals(_marbleTab))
            {
                navigateMarble(f);
            }
            else if(ti.Equals(_infoTab))
            {
                navigateInfo(f);
            }

            ti.Content = f;
        }
        public void NavigateSettings(TabItem ti)
        {
            Frame f = new Frame();

            if (ti.Equals(_weightTabSettings))
            {
                WeightSettings ws = new WeightSettings();
                f.Content = ws;
            }
            else if (ti.Equals(_movementTabSettings))
            {
                MovementSettings ms = new MovementSettings();
                f.Content = ms;
            }
            else if (ti.Equals(_cogTabSettings))
            {
                CogSettings cs = new CogSettings();
                f.Content = cs;
            }
            else if (ti.Equals(_marbleTabSettings))
            {

            }

            ti.Content = f;
        }