Пример #1
0
        /// <summary>
        /// Starts VLoop.
        /// </summary>
        public void Start()
        {
            SplashScreen splash = new SplashScreen();

            splash.Show();
            splash.Invalidate();
            splash.Update();
            _work_mode             = WorkModes.None;
            _errors                = new ArrayList();
            _forward_viewstack     = new Stack();
            _back_viewstack        = new Stack();
            _parent_form           = new frmMain();
            _parent_form.AppObject = this;

            //manager objects
            _menu_manager = new MenuManager(this);
            _menu_manager.CreateMenu();
            _call = new CallStatus(this);

            CreateExplorers();
            CreateViews();
            CreateCommands();
            CreateStates();
            ApplyRegistrySettings();

            _parent_form.Show();
            splash.Hide();
            ((VLoopCommand)_commands[ActionTypes.Login]).Execute();
            System.Windows.Forms.Application.Run(_parent_form);
        }
        public void AssignReceived(SyncBlockSettings newSettings, NanobotBuildAndRepairSystemPriorityHandling buildPriority)
        {
            _AllowBuild     = newSettings.AllowBuild;
            _UseIgnoreColor = newSettings.UseIgnoreColor;
            _IgnoreColor    = newSettings.IgnoreColor;
            _UseGrindColor  = newSettings.UseGrindColor;
            _GrindColor     = newSettings.GrindColor;
            _ShowArea       = newSettings.ShowArea;

            _AreaWidthLeft    = newSettings.AreaWidthLeft;
            _AreaWidthRight   = newSettings.AreaWidthRight;
            _AreaHeightTop    = newSettings.AreaHeightTop;
            _AreaHeightBottom = newSettings.AreaHeightBottom;
            _AreaDepthFront   = newSettings.AreaDepthFront;
            _AreaDepthRear    = newSettings.AreaDepthRear;

            _BuildPriority = newSettings.BuildPriority;

            _ScriptControlled = newSettings.ScriptControlled;
            _SoundVolume      = newSettings.SoundVolume;
            _SearchMode       = newSettings.SearchMode;
            _WorkMode         = newSettings.WorkMode;

            RecalcAreaBoundigBox();
            buildPriority.SetEntries(BuildPriority);

            Changed = 2u;
        }
Пример #3
0
        /// <summary>
        /// 初始化工作模式和SubWorkMode
        /// </summary>
        private void InitWorkModes()
        {
            if (configCameraModel == null)
            {
                return;
            }

            foreach (var usercase in configCameraModel.UserCases)
            {
                var wm = new ComboBoxViewMode <WorkModeE> {
                    Description = usercase.WorkMode.ToString(), SelectedModel = usercase.WorkMode, IsShow = Visibility.Visible
                };
                if (!WorkModes.Exists(item => item.SelectedModel == wm.SelectedModel))
                {
                    WorkModes.Add(wm);
                }

                var swm = new ComboBoxViewMode <SubWorkModeE> {
                    Description = usercase.SubWorkMode.ToString(), SelectedModel = usercase.SubWorkMode, IsShow = Visibility.Visible
                };
                if (!SubWorkModes.Exists(item => item.SelectedModel == swm.SelectedModel))
                {
                    SubWorkModes.Add(swm);
                }
            }

            //初始化的时候默认的SubWorkMode,其实是根据默认的WorkMode
            FilterSubWorkMode((WorkModeE)WorkMode);
        }
Пример #4
0
        private void SetWorkMode(WorkModes mode)
        {
            dragButton.Enabled   = (mode != WorkModes.Drag);
            modifyButton.Enabled = (mode != WorkModes.Modify);
            this.mode            = mode;

            if (mode == WorkModes.Drag)
            {
                Canvas.Cursor = Cursors.SizeAll;
                Model.SelectedPoints.Clear();
            }
            else
            {
                Canvas.Cursor = Cursors.Cross;
            }
        }
        public SyncBlockSettings()
        {
            _AllowBuild       = true;
            _UseIgnoreColor   = false;
            _IgnoreColor      = Vector3.Zero;
            _UseGrindColor    = false;
            _GrindColor       = Vector3.Zero;
            _ShowArea         = false;
            _BuildPriority    = string.Empty;
            _ScriptControlled = false;
            _SoundVolume      = NanobotBuildAndRepairSystemBlock.WELDER_SOUND_VOLUME / 2;
            _SearchMode       = SearchModes.Grids;
            _WorkMode         = WorkModes.WeldBeforeGrind;

            Changed          = 0;
            _LastStored      = MyAPIGateway.Session.ElapsedPlayTime;
            _LastTransmitted = MyAPIGateway.Session.ElapsedPlayTime;

            RecalcAreaBoundigBox();
        }
Пример #6
0
        public bool Work(Sample[] output, int n, WorkModes mode)
        {
            if ((host.SubTickInfo.CurrentSubTick == 0) || (subTickCount > (host.SubTickInfo.SubTicksPerTick / updatesPerTick)))
            {
                for (int i = 0; i < Peers.Count; i++)
                {
                    Peer p = Peers[i];
                    if ((p != null) && p.OnOff)//&& (tracks[i].peerOnOff))
                    {
                        p.Update();
                    }
                }

                subTickCount = 0;
            }
            if (host.SubTickInfo.PosInSubTick == 0)
                subTickCount++;
            return true;
        }
Пример #7
0
        /// <summary>
        /// Инициализировать данные уровня приложения
        /// </summary>
        public static SchemeApp InitSchemeApp(WorkModes workMode)
        {
            SchemeApp schemeApp;

            if (schemeAppObj == null)
            {
                schemeApp          = new SchemeApp();
                schemeAppObj       = schemeApp;
                schemeApp.WorkMode = workMode;

                if (workMode == WorkModes.Monitor)
                {
                    // инициализация общих данных приложения SCADA-Web
                    AppData.InitAppData();
                    schemeApp.MainData = AppData.MainData;

                    // настройка журнала приложения
                    schemeApp.Log.FileName = AppData.LogDir + "ScadaScheme.log";
                    schemeApp.Log.Encoding = Encoding.UTF8;
                    schemeApp.Log.WriteBreak();
                    schemeApp.Log.WriteAction(Localization.UseRussian ? "Запуск SCADA-Схемы" :
                                              "Start SCADA-Scheme", Log.ActTypes.Action);
                }
                else // WorkModes.Edit
                {
                    // инициализация данных редактора схем
                    schemeApp.EditorData = new EditorData();

                    // настройка журнала приложения
                    schemeApp.Log.FileName = ScadaUtils.NormalDir(Path.GetDirectoryName(Application.ExecutablePath)) +
                                             "log\\ScadaSchemeEditor.log";
                    schemeApp.Log.Encoding = Encoding.UTF8;
                    schemeApp.Log.WriteBreak();
                    schemeApp.Log.WriteAction(Localization.UseRussian ? "Запуск SCADA-Редактора схем" :
                                              "Start SCADA-Scheme Editor", Log.ActTypes.Action);
                }
            }
            else if (schemeAppObj.WorkMode != workMode)
            {
                throw new ArgumentException(Localization.UseRussian ?
                                            "Ошибка при инициализации данных приложения SCADA-Схема: некорректный режим работы." :
                                            "Error initializing SCADA-Scheme application data: incorrect work mode.", "workMode");
            }
            else
            {
                schemeApp = schemeAppObj;
            }

            if (workMode == WorkModes.Monitor)
            {
                // получение настроек Silverlight-приложения из настроек SCADA-Web
                schemeApp.SchemeSettings.RefrFreq   = AppData.WebSettings.SrezRefrFreq;
                schemeApp.SchemeSettings.CmdEnabled = AppData.WebSettings.CmdEnabled;
            }

            // инициализировать используемые фразы
            schemeApp.SchemeSettings.SchemePhrases.Init();
            SchemePhrases.InitStatic();

            return(schemeApp);
        }
Пример #8
0
        /// <summary>
        /// Инициализировать данные уровня приложения
        /// </summary>
        public static SchemeApp InitSchemeApp(WorkModes workMode)
        {
            SchemeApp schemeApp;

            if (schemeAppObj == null)
            {
                schemeApp = new SchemeApp();
                schemeAppObj = schemeApp;
                schemeApp.WorkMode = workMode;

                if (workMode == WorkModes.Monitor)
                {
                    // инициализация общих данных приложения SCADA-Web
                    AppData.InitAppData();
                    schemeApp.MainData = AppData.MainData;

                    // настройка журнала приложения
                    schemeApp.Log.FileName = AppData.LogDir + "ScadaScheme.log";
                    schemeApp.Log.Encoding = Encoding.UTF8;
                    schemeApp.Log.WriteBreak();
                    schemeApp.Log.WriteAction(Localization.UseRussian ? "Запуск SCADA-Схемы" : 
                        "Start SCADA-Scheme", Log.ActTypes.Action);
                }
                else // WorkModes.Edit
                {
                    // инициализация данных редактора схем
                    schemeApp.EditorData = new EditorData();

                    // настройка журнала приложения
                    schemeApp.Log.FileName = ScadaUtils.NormalDir(Path.GetDirectoryName(Application.ExecutablePath)) + 
                        "log\\ScadaSchemeEditor.log";
                    schemeApp.Log.Encoding = Encoding.UTF8;
                    schemeApp.Log.WriteBreak();
                    schemeApp.Log.WriteAction(Localization.UseRussian ? "Запуск SCADA-Редактора схем" :
                        "Start SCADA-Scheme Editor", Log.ActTypes.Action);
                }
            }
            else if (schemeAppObj.WorkMode != workMode)
            {
                throw new ArgumentException(Localization.UseRussian ?
                    "Ошибка при инициализации данных приложения SCADA-Схема: некорректный режим работы." : 
                    "Error initializing SCADA-Scheme application data: incorrect work mode.", "workMode");
            }
            else
            {
                schemeApp = schemeAppObj;
            }

            if (workMode == WorkModes.Monitor)
            {
                // получение настроек Silverlight-приложения из настроек SCADA-Web
                schemeApp.SchemeSettings.RefrFreq = AppData.WebSettings.SrezRefrFreq;
                schemeApp.SchemeSettings.CmdEnabled = AppData.WebSettings.CmdEnabled;
            }

            // инициализировать используемые фразы
            schemeApp.SchemeSettings.SchemePhrases.Init();
            SchemePhrases.InitStatic();

            return schemeApp;
        }