示例#1
0
 public MainViewModel(MainWindow mainWindow)
 {
     _rengaApplication = new Renga.Application();
     _mainWindow       = mainWindow;
     AcceptCommand     = new RelayCommandWithoutParameter(Accept);
     SelectAllCommand  = new RelayCommandWithoutParameter(SelectAll);
     SelectNoneCommand = new RelayCommandWithoutParameter(SelectNone);
 }
示例#2
0
        /// <inheritdoc/>
        public bool Initialize(string pluginFolder)
        {
            RengaApplication   = new Renga.Application();
            ActionEventSources = new List <Renga.ActionEventSource>();
            try
            {
                // init lang
                if (!Language.Initialize())
                {
                    return(false);
                }

                // statistic
                Statistic.SendPluginStarting("Renga", "4.0");

                // Принудительная загрузка сборок
                LoadAssemblies();
                UserConfigFile.InitConfigFile();
                LoadFunctions();

                MenuBuilder.Build(RengaApplication, ActionEventSources);

                // проверка загруженности модуля автообновления
                CheckAutoUpdaterLoaded();

                var disableConnectionWithLicenseServer = Variables.DisableConnectionWithLicenseServerInRenga;

                // license server
                if (Variables.IsLocalLicenseServerEnable && !disableConnectionWithLicenseServer)
                {
                    ClientStarter.StartConnection(SupportedProduct.Renga);
                }

                if (Variables.IsWebLicenseServerEnable && !disableConnectionWithLicenseServer)
                {
                    WebLicenseServerClient.Instance.Start(SupportedProduct.Renga);
                }

                // user info
                AuthorizationOnStartup();

                return(true);
            }
            catch (Exception exception)
            {
                RengaApplication.UI.ShowMessageBox(Renga.MessageIcon.MessageIcon_Error, "ModPlus", exception.Message);
                return(false);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        public MainViewModel()
        {
            _rengaApplication = new Renga.Application();
            QuantityMap       = new QuantityMap();

            var types = new List <LocalizableObjectType>
            {
                new LocalizableObjectType(Guid.Empty)
            };

            types.AddRange(typeof(Renga.ObjectTypes)
                           .GetProperties()
                           .Select(p => (Guid)p.GetValue(null))
                           .Select(guid => new LocalizableObjectType(guid)));
            ObjectTypes = types;

            _quantityIds = new List <Guid>(typeof(Renga.QuantityIds).GetProperties().Select(p => (Guid)p.GetValue(null)));

            ShowButtonVisibility = _rengaApplication.ActiveView.Type == Renga.ViewType.ViewType_View3D
                ? Visibility.Visible
                : Visibility.Collapsed;
        }