Ejemplo n.º 1
0
 public void changeModeToPros()
 {
     infoMode = InfoMode.prosMode;
     anatomyInfo.SetActive(false);
     endoInfo.SetActive(false);
     prosInfo.SetActive(true);
 }
        public static void Prefix(InfoMode mode, SubInfoMode subMode)
        {
            if (!RoadSelectionPanels.Root)
            {
                return;
            }

            if (RoadSelectionPanels.Root.RoadWorldInfoPanelExt != null)
            {
                RoadSelectionPanels.Root.RoadWorldInfoPanelExt.isVisible =
                    mode == InfoMode.None ||
                    RoadSelectionUtil.IsNetAdjustMode(mode, (int)subMode);
            }
            if (RoadSelectionUtil.IsNetAdjustMode(mode, (int)subMode))
            {
                // UI to be handled by Default tool
                ModUI.Instance.CloseMainMenu();

                SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(() => {
                    DefaultTool.OpenWorldInfoPanel(
                        Singleton <InstanceManager> .instance.GetSelectedInstance(),
                        Input.mousePosition);
                });
            }
            else
            {
                SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(RoadSelectionPanels.RoadWorldInfoPanel.Hide);
            }
        }
Ejemplo n.º 3
0
        private void combo_info_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((combo_info.IsDropDownOpen || combo_info.IsSelectionBoxHighlighted) && combo_info.SelectedItem != null)
            {
                infomode = (InfoMode)Enum.Parse(typeof(InfoMode), combo_info.SelectedItem.ToString(), true);
                Title    = "Info (" + infomode.ToString() + ")";

                if (infilepath != null)
                {
                    tbxInfo.Clear();
                    tbxInfo.ScrollToHome();
                    GetInfo();
                }
            }
        }
Ejemplo n.º 4
0
        public MediaInfo(string infilepath, InfoMode infomode, System.Windows.Window owner)
        {
            this.InitializeComponent();
            this.Owner      = owner;
            this.infomode   = infomode;
            this.infilepath = infilepath;

            DDHelper ddh = new DDHelper(this);

            ddh.GotFiles += new DDEventHandler(DD_GotFiles);

            Title = "Info (" + infomode.ToString() + ")";
            button_open.Content  = Languages.Translate("Open");
            button_save.Content  = Languages.Translate("Save");
            button_close.Content = Languages.Translate("Close");
            tbxInfo.ToolTip      = Languages.Translate("Drag and Drop your files here");
            check_wrap.Content   = Languages.Translate("Wrap text");

            if (Settings.MI_WrapText)
            {
                check_wrap.IsChecked = true;
                tbxInfo.TextWrapping = TextWrapping.Wrap;
            }
            else
            {
                check_wrap.IsChecked = false;
                tbxInfo.TextWrapping = TextWrapping.NoWrap;
            }

            foreach (string info in Enum.GetNames(typeof(InfoMode)))
            {
                combo_info.Items.Add(info);
            }
            combo_info.SelectedItem = infomode.ToString();

            if (infilepath != null)
            {
                GetInfo();
            }

            Show();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 取得父類別的相關資訊(共用的Functiond可用)
        /// </summary>
        /// <returns></returns>
        public static string GetParentInfo(InfoMode infoMode)//ParentInfoMode InfoMode
        {
            string     showString = "";
            StackTrace ss         = new StackTrace(true);

#if DEBUG
            //取得呼叫當前方法之上 2 層類別(GetFrame(1))的屬性
            MethodBase mb = ss.GetFrame(2).GetMethod();
#else
            //取得呼叫當前方法之上 1 層類別(GetFrame(1))的屬性
            MethodBase mb = ss.GetFrame(1).GetMethod();
#endif
            switch (infoMode)
            {
            case InfoMode.Namespace:
                //取得呼叫當前方法之上一層類別(父方)的命名空間名稱
                showString += mb.DeclaringType.Namespace + "\n";
                break;

            case InfoMode.ParentName:
                //取得呼叫當前方法之上一層類別(父方)的function 所屬class Name
                showString += mb.DeclaringType.Name + "\n";
                break;

            case InfoMode.FullName:
                //取得呼叫當前方法之上一層類別(父方)的Full class Name
                showString += mb.DeclaringType.FullName + "\n";
                break;

            case InfoMode.Name:
            default:
                //取得呼叫當前方法之上一層類別(父方)的Function Name
                showString += mb.Name + "\n";
                break;
            }
            return(showString);
        }
Ejemplo n.º 6
0
        public MediaInfo(string infilepath, InfoMode infomode, System.Windows.Window owner)
        {
            this.InitializeComponent();
            this.Owner = owner;
            this.infomode = infomode;
            this.infilepath = infilepath;

            DDHelper ddh = new DDHelper(this);
            ddh.GotFiles += new DDEventHandler(DD_GotFiles);

            Title = "Info (" + infomode.ToString() + ")";
            button_open.Content = Languages.Translate("Open");
            button_save.Content = Languages.Translate("Save");
            button_close.Content = Languages.Translate("Close");
            tbxInfo.ToolTip = Languages.Translate("Drag and Drop your files here");
            check_wrap.Content = Languages.Translate("Wrap text");

            if (Settings.MI_WrapText)
            {
                check_wrap.IsChecked = true;
                tbxInfo.TextWrapping = TextWrapping.Wrap;
            }
            else
            {
                check_wrap.IsChecked = false;
                tbxInfo.TextWrapping = TextWrapping.NoWrap;
            }

            foreach (string info in Enum.GetNames(typeof(InfoMode)))
                combo_info.Items.Add(info);
            combo_info.SelectedItem = infomode.ToString();

            if (infilepath != null)
                GetInfo();

            Show();
        }
Ejemplo n.º 7
0
        private void combo_info_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((combo_info.IsDropDownOpen || combo_info.IsSelectionBoxHighlighted) && combo_info.SelectedItem != null)
            {
                infomode = (InfoMode)Enum.Parse(typeof(InfoMode), combo_info.SelectedItem.ToString(), true);
                Title = "Info (" + infomode.ToString() + ")";

                if (infilepath != null)
                {
                    tbxInfo.Clear();
                    tbxInfo.ScrollToHome();
                    GetInfo();
                }
            }
        }
Ejemplo n.º 8
0
    private void ChangeMode(InfoMode nmode)
    {
        if (mode != nmode)
        {
            //prev mode
            switch (mode)
            {
            case InfoMode.Expeditions:
                showingExpedition = null;
                expeditionButtonImage.overrideSprite = null;
                break;

            case InfoMode.Crews:
                showingCrew = null;
                crewButtonImage.overrideSprite = null;
                break;

            case InfoMode.Artifacts:
                showingArtifact = null;
                artifactButtonImage.overrideSprite = null;
                break;
            }
            mode = nmode;
            if (activeObserver != null)
            {
                activeObserver.SetActive(false);
            }
            selectedItem = -1;
            switch (mode)
            {
            case InfoMode.Crews:
            {
                PrepareCrewsList();
                crewButtonImage.overrideSprite = PoolMaster.gui_overridingSprite;

                if (Crew.crewsList.Count != 0)
                {
                    var ert = emptyPanel.GetComponent <RectTransform>();
                    var r   = new Rect(ert.position, ert.rect.size);
                    SelectItem(0);
                }
                else
                {
                    if (activeObserver != null)
                    {
                        activeObserver.SetActive(false);
                        activeObserver = null;
                    }
                    emptyPanel.transform.GetChild(0).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.NoCrews);
                    emptyPanel.SetActive(true);
                }
                lastDrawnActionHash = Crew.listChangesMarkerValue;
                break;
            }

            case InfoMode.Artifacts:
            {
                PrepareArtifactsList();
                artifactButtonImage.overrideSprite = PoolMaster.gui_overridingSprite;

                if (Artifact.artifactsList.Count != 0)
                {
                    var ert = emptyPanel.GetComponent <RectTransform>();
                    var r   = new Rect(ert.position, ert.rect.size);
                    SelectItem(0);
                }
                else
                {
                    if (activeObserver != null)
                    {
                        activeObserver.SetActive(false);
                        activeObserver = null;
                    }
                    emptyPanel.transform.GetChild(0).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.NoArtifacts);
                    emptyPanel.SetActive(true);
                }
                lastDrawnActionHash = Artifact.listChangesMarkerValue;
                break;
            }

            case InfoMode.Expeditions:
            {
                PrepareExpeditionsList();
                expeditionButtonImage.overrideSprite = PoolMaster.gui_overridingSprite;

                if (Expedition.expeditionsList.Count != 0)
                {
                    var ert = emptyPanel.GetComponent <RectTransform>();
                    SelectItem(0);
                }
                else
                {
                    if (activeObserver != null)
                    {
                        activeObserver.SetActive(false);
                        activeObserver = null;
                    }
                    emptyPanel.transform.GetChild(0).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.NoExpeditions);
                    emptyPanel.SetActive(true);
                }
                lastDrawnActionHash = Expedition.listChangesMarker;
                break;
            }

            case InfoMode.Inactive:
                lastDrawnActionHash = -1;
                break;
            }
        }
    }
Ejemplo n.º 9
0
    //

    private void ChangeMode(InfoMode nmode)
    {
        if (mode != nmode)
        {
            //prev mode            
            switch (mode)
            {
                case InfoMode.Expeditions:
                    selectedExpedition = null;
                    expeditionButtonImage.overrideSprite = null;
                    break;
                case InfoMode.Crews:
                    selectedCrew = null;
                    crewButtonImage.overrideSprite = null;
                    break;
                case InfoMode.Artifacts:
                    selectedArtifact = null;
                    artifactButtonImage.overrideSprite = null;
                    break;
            }
            mode = nmode;
            if (activeObserver != null) activeObserver.SetActive(false);
            
            switch (mode)
            {
                case InfoMode.Crews:
                    {
                        listController.PrepareList(crewsData);
                        crewButtonImage.overrideSprite = PoolMaster.gui_overridingSprite;

                        if (Crew.crewsList.Count != 0)
                        {
                            if (selectedCrew == null) SelectItem(0);
                        }
                        else
                        {
                            if (activeObserver != null)
                            {
                                activeObserver.SetActive(false);
                                activeObserver = null;
                            }
                            listController.ChangeEmptyLabelText(Localization.GetPhrase(LocalizedPhrase.NoCrews));
                        }
                        lastDrawnActionHash = Crew.listChangesMarkerValue;
                        if (!listController.isActiveAndEnabled) listController.gameObject.SetActive(true);
                        break;
                    }
                case InfoMode.Artifacts:
                    {
                        listController.PrepareList(artifactsData);
                        artifactButtonImage.overrideSprite = PoolMaster.gui_overridingSprite;

                        if (Artifact.artifactsList.Count != 0)
                        {
                            if (selectedArtifact == null) SelectItem(0);
                        }
                        else
                        {
                            if (activeObserver != null)
                            {
                                activeObserver.SetActive(false);
                                activeObserver = null;
                            }
                            listController.ChangeEmptyLabelText(Localization.GetPhrase(LocalizedPhrase.NoArtifacts));
                        }
                        lastDrawnActionHash = Artifact.listChangesMarkerValue;
                        if (!listController.isActiveAndEnabled) listController.gameObject.SetActive(true);
                        break;
                    }
                case InfoMode.Expeditions:
                    {
                        listController.PrepareList(expeditionsData);
                        expeditionButtonImage.overrideSprite = PoolMaster.gui_overridingSprite;

                        if (Expedition.expeditionsList.Count != 0)
                        {                           
                            if (selectedExpedition == null) SelectItem(0);
                        }
                        else
                        {
                            if (activeObserver != null)
                            {
                                activeObserver.SetActive(false);
                                activeObserver = null;
                            }
                            listController.ChangeEmptyLabelText(Localization.GetPhrase(LocalizedPhrase.NoExpeditions));
                        }
                        lastDrawnActionHash = Expedition.listChangesMarker;
                        if (!listController.isActiveAndEnabled) listController.gameObject.SetActive(true);
                        break;
                    }
                case InfoMode.Inactive:
                    if (listController.isActiveAndEnabled) listController.gameObject.SetActive(false);
                    lastDrawnActionHash = -1;
                    break;
            }
        }
    }
Ejemplo n.º 10
0
        /// <summary>
        /// 刷新信息.
        /// </summary>
        private void RefreshInfo()
        {
            string name = cboAssembly.SelectedItem as string;

            if (null == name)
            {
                return;
            }
            // 重新获取程序集.
            if (!name.Equals(m_OldAssemblyName, StringComparison.Ordinal))
            {
                try {
                    m_CurAssembly     = InfoAssembly.LoadAssembly(name);
                    m_OldAssemblyName = name;
                    RefreshModeList();
                }
                catch (Exception ex) {
                    m_OldAssemblyName = null;
                    txtInfo.Text      = ex.ToString();
                }
            }
            if (null == m_CurAssembly)
            {
                return;
            }
            // 计算显示方式.
            InfoMode mode   = 0;
            Type     tp     = null;
            bool     isshow = false;
            object   obj    = cboMode.SelectedItem;

            if (obj is Type)
            {
                tp     = obj as Type;
                isshow = true;
            }
            else if (obj is InfoMode)
            {
                mode   = (InfoMode)obj;
                isshow = true;
            }
            if (!isshow)
            {
                return;
            }
            // 显示信息.
            StringBuilder         sb      = new StringBuilder();
            IIndentedWriter       iw      = new TextIndentedWriter(new StringWriter(sb));
            IndentedWriterContext context = new IndentedWriterContext();

            context.VisitOnce = (bool)chkVisitOnce.IsChecked;
            //this.UseWaitCursor = true;
            this.Cursor = Cursors.Wait;
            //Application.DoEvents();
            try {
                if (null != tp)
                {
                    IndentedWriterMemberOptions options = IndentedWriterMemberOptions.OnlyStatic;
                    if (chkMethod.IsChecked != false)
                    {
                        options |= IndentedWriterMemberOptions.AllowMethod;
                    }
                    InfoAssembly.WriteTypeStatic(iw, context, tp, options);
                }
                else
                {
                    InfoAssembly.WriteInfo(iw, context, m_CurAssembly, mode);
                }
            }
            catch (Exception ex) {
                sb.AppendLine(ex.ToString());
            }
            //this.UseWaitCursor = false;
            this.Cursor  = null;
            txtInfo.Text = sb.ToString();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 刷新信息.
        /// </summary>
        private void RefreshInfo()
        {
            if (null == cboAssembly)
            {
                return;
            }
            string name = cboAssembly.SelectedItem as string;

            if (null == name)
            {
                return;
            }
            // 重新获取程序集.
            if (!name.Equals(m_OldAssemblyName, StringComparison.Ordinal))
            {
                try {
                    m_CurAssembly     = InfoAssembly.LoadAssembly(name);
                    m_OldAssemblyName = name;
                    RefreshModeList();
                }
                catch (Exception ex) {
                    m_OldAssemblyName = null;
                    txtInfo.Text      = ex.ToString();
                    return;
                }
            }
            if (null == m_CurAssembly)
            {
                return;
            }
            // 计算显示方式.
            InfoMode mode   = 0;
            Type     tp     = null;
            bool     isshow = false;
            object   obj    = cboMode.SelectedItem;

            if (obj is Type)
            {
                tp     = obj as Type;
                isshow = true;
            }
            else if (obj is InfoMode)
            {
                mode   = (InfoMode)obj;
                isshow = true;
            }
            if (!isshow)
            {
                return;
            }
            // 显示信息.
            StringBuilder         sb      = new StringBuilder();
            IIndentedWriter       iw      = new TextIndentedWriter(new StringWriter(sb));
            IndentedWriterContext context = new IndentedWriterContext();

            context.VisitOnce = (bool)chkVisitOnce.IsChecked;
            //this.UseWaitCursor = true;
            //this.Cursor = Cursors.Wait;
            //Application.DoEvents();
            try {
                // test
                //if (false) {
                //	sb.AppendFormat("{0}:\n", m_CurAssembly.FullName);
                //	//IndentedObjectFunctor.CommonProc(iw, m_CurAssembly, null);
                //	Type tp1 = m_CurAssembly.GetType();
                //	foreach (PropertyInfo pi in tp1.GetRuntimeProperties()) {
                //		if (pi.CanRead && pi.GetIndexParameters().Length <= 0) {
                //			try {
                //				object o = pi.GetValue(m_CurAssembly);
                //				sb.AppendFormat("{0}:\t{1}\n", pi.Name, o);
                //			}
                //			catch (Exception ex) {
                //				sb.AppendFormat("{0}\n", ex);
                //			}
                //		}
                //	}
                //}
                // show
                if (true)
                {
                    if (null != tp)
                    {
                        IndentedWriterMemberOptions options = IndentedWriterMemberOptions.OnlyStatic;
                        if (chkMethod.IsChecked != false)
                        {
                            options |= IndentedWriterMemberOptions.AllowMethod;
                        }
                        InfoAssembly.WriteTypeStatic(iw, context, tp, options);
                    }
                    else
                    {
                        InfoAssembly.WriteInfo(iw, context, m_CurAssembly, mode);
                    }
                }
            }
            catch (Exception ex) {
                sb.AppendLine(ex.ToString());
            }
            //this.UseWaitCursor = false;
            //this.Cursor = null;
            txtInfo.Text = sb.ToString();
        }
Ejemplo n.º 12
0
 internal Visitor(InfoMode infoMode)
 {
     this.InfoM = infoMode;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// 输出信息.
        /// </summary>
        /// <param name="iw">输出者.</param>
        /// <param name="context">输出时的环境.</param>
        /// <param name="assembly">程序集.</param>
        /// <param name="mode">模式.</param>
        /// <returns>是否成功.</returns>
        public static bool WriteInfo(IIndentedWriter iw, IndentedWriterContext context, Assembly assembly, InfoMode mode)
        {
            bool rt = false;

            switch (mode)
            {
            case InfoMode.AssemblyProperty:
                rt = WriteInfo_AssemblyProperty(iw, context, assembly);
                break;

            case InfoMode.TypeName:
                rt = WriteInfo_TypeName(iw, context, assembly, false);
                break;

            case InfoMode.TypeString:
                rt = WriteInfo_TypeName(iw, context, assembly, true);
                break;

            case InfoMode.TypeStaticHas:
                rt = WriteInfo_TypeStaticHas(iw, context, assembly, IndentedWriterMemberOptions.OnlyStatic);
                break;

            case InfoMode.TypeStaticHasM:
                rt = WriteInfo_TypeStaticHas(iw, context, assembly, IndentedWriterMemberOptions.OnlyStatic | IndentedWriterMemberOptions.AllowMethod);
                break;
                //case InfoMode.TypeStaticProperty:
                //    rt = WriteInfo_TypeStatic(iw, context, assembly, IndentedWriterMemberOptions.OnlyStatic);
                //    break;
                //case InfoMode.TypeStaticPropertyMethod:
                //    rt = WriteInfo_TypeStatic(iw, context, assembly, IndentedWriterMemberOptions.OnlyStatic | IndentedWriterMemberOptions.AllowMethod);
                //    break;
            }
            return(rt);
        }