Пример #1
0
        public void Navigate(TabItem tab, BlankTab blank)
        {
            Frame frame = tab.Content as Frame;

            frame.NavigationUIVisibility = NavigationUIVisibility.Hidden;
            frame.JournalOwnership       = JournalOwnership.OwnsJournal;
            frame.Navigate(blank);
        }
Пример #2
0
        //HANDLERS
        public void SelectionChanged_Handler(object sender, SelectionChangedEventArgs args)
        {
            TabItem tab = tabControl_DynamicTabs.SelectedItem as TabItem;

            if (tab != null && tab.Header != null)
            {
                if (tab.Header.Equals(tabAdd.Header))
                {
                    //Unhook, add tab to list and hook back, then assign the new tab as the current tab
                    tabControl_DynamicTabs.DataContext = null;
                    TabItem newTab = AddTabItem();
                    InsertTab(newTab);
                    BlankTab blank = new BlankTab((Frame)newTab.Content, camera, modelList);
                    Navigate(newTab, blank);
                }
                else if (!((tab.Content as Frame).Content is BlankTab) && !((tab.Content as Frame).Content is null))
                {
                    ((tab.Content as Frame).Content as CameraMode).InstantUpdate();
                }
            }
        }
Пример #3
0
        public void TabLoader(string tabName, string camMode, List <string[]> map)
        {
            TabItem  tab   = AddTabItem(tabName);
            BlankTab blank = new BlankTab((Frame)tab.Content, camera, modelList);

            //System.Console.WriteLine(camMode);
            try {
                switch (camMode)
                {
                case "FixedCM":
                    blank.SelectCamMode("Fixed");
                    FixedCM fixCM = (FixedCM)blank.CurrentCamMode;
                    fixCM.fixedPos_FixedCM.Value          = Utilities.Str2Point3D(map[0][1]);
                    fixCM.fixedRot_FixedCM.Value          = Utilities.Str2Point3D(map[1][1]);
                    fixCM.autoTracking_FixedCM.IsChecked  = bool.Parse(map[2][1]);
                    fixCM.closestCamera_FixedCM.IsChecked = bool.Parse(map[3][1]);
                    fixCM.AssignList(Utilities.Str2PointList(map[4][1]));
                    break;

                case "ChaseCM":
                    blank.SelectCamMode("Chase");
                    ChaseCM chaCM = blank.CurrentCamMode as ChaseCM;
                    chaCM.rPos_ChaseCM.Value         = Utilities.Str2Point3D(map[0][1]);
                    chaCM.fixedAxis_ChaseCM.Value    = Utilities.Str2Point3D(map[1][1]);
                    chaCM.tightness_ChaseCM.Value    = double.Parse(map[2][1]);
                    chaCM.freeAxis_ChaseCM.IsChecked = bool.Parse(map[3][1]);
                    chaCM.rOffset_ChaseCM.Value      = Utilities.Str2Point3D(map[4][1]);
                    break;

                case "AttachedCM":
                    blank.SelectCamMode("Attached");
                    AttachedCM attCM = blank.CurrentCamMode as AttachedCM;
                    attCM.rPos_AttachedCM.Value           = Utilities.Str2Point3D(map[0][1]);
                    attCM.rRot_AttachedCM.Value           = Utilities.Str2Point3D(map[1][1]);
                    attCM.charVision_AttachedCM.IsChecked = bool.Parse(map[3][1]);
                    break;

                case "PlaneBindedCM":
                    blank.SelectCamMode("Plane Binded");
                    PlaneBindedCM      plbCM  = blank.CurrentCamMode as PlaneBindedCM;
                    List <CVPlaneItem> planes = Utilities.Str2PlaneList(map[0][1]);
                    plbCM.AssignList(planes);
                    plbCM.tightness_PlaneBindedCM.Value   = double.Parse(map[1][1]);
                    plbCM.pView_PlaneBindedCM.IsChecked   = bool.Parse(map[2][1]);
                    plbCM.zoom_PlaneBindedCM.Value        = double.Parse(map[3][1]);
                    plbCM.rtsMode_PlaneBindedCM.IsChecked = bool.Parse(map[4][1]);
                    if (plbCM.rtsMode_PlaneBindedCM.IsChecked == true)
                    {
                        plbCM.leftAxis_PlaneBindedCM.Value = (Vector3D)Utilities.Str2Point3D(map[5][1]);
                        plbCM.upAxis_PlaneBindedCM.Value   = (Vector3D)Utilities.Str2Point3D(map[6][1]);
                        plbCM.confirmSys_PlaneBindedCM.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
                    }
                    plbCM.pitch_PlaneBindedCM.Value = double.Parse(map[7][1]);
                    plbCM.disp_PlaneBindedCM.Value  = Utilities.Str2Point3D(map[8][1]);
                    plbCM.moveF_PlaneBindedCM.Value = double.Parse(map[9][1]);
                    break;

                case "ThroughTargetCM":
                    blank.SelectCamMode("Through Target");
                    ThroughTargetCM thrCM = blank.CurrentCamMode as ThroughTargetCM;
                    //thrCM.fAxis_ThroughTargetCM.Value = Utilities.Str2Point3D(map[0][1]);
                    thrCM.fPos_ThroughTargetCM.Value         = Utilities.Str2Point3D(map[0][1]);
                    thrCM.margin_ThroughTargetCM.Value       = double.Parse(map[1][1]);
                    thrCM.iControl_ThroughTargetCM.IsChecked = bool.Parse(map[2][1]);
                    break;

                case "FixedDirectionCM":
                    blank.SelectCamMode("Fixed Direction");
                    FixedDirectionCM fxdCM = blank.CurrentCamMode as FixedDirectionCM;
                    fxdCM.fDir_FixedDirectionCM.Value = Utilities.Str2Point3D(map[0][1]);
                    //fxdCM.fAxis_FixedDirectionCM.Value = Utilities.Str2Point3D(map[1][1]);
                    fxdCM.dist_FixedDirectionCM.Value      = double.Parse(map[1][1]);
                    fxdCM.tightness_FixedDirectionCM.Value = double.Parse(map[2][1]);
                    break;
                }
            } catch (System.Exception e) {
                System.Console.WriteLine(e.Message + "\n" + e.Source + "\n" + e.StackTrace);
                MessageBox.Show("Error at reading the file.\nCause: " + e.Message);
                return;
            }
            InsertTab(tab);
            Navigate(tab, blank);
            blank.Navigate();
        }