Exemple #1
0
 Image GetWarningIcon(Size size)
 {
     using (Stream stream = AppAssembly.GetManifestResourceStream("CustomAppointmentFlyoutExample.warning.svg")) {
         var paletteProvider = SvgPaletteHelper.GetSvgPalette(schedulerControl1.LookAndFeel, ObjectState.Selected);
         return(SvgBitmap.FromStream(stream).Render(size, paletteProvider));
     }
 }
Exemple #2
0
        /// <summary>
        /// Show message
        /// </summary>
        public void ShowAboutDialog()
        {
            AppAssembly Assembly = new AppAssembly();

            Container.Resolve <IMetroMessageDisplayService>(ServiceNames.MetroMessageDisplayService).ShowMessageAsnyc(
                Assembly.Title + " v" + Assembly.Version, Assembly.Description
                );
        }
Exemple #3
0
 /// <summary>
 /// Set UserAgent
 /// </summary>
 /// <param name="ua"></param>
 public static void setUa(string ua = "")
 {
     if (ua == "")
     {
         var assembly = new AppAssembly();
         ua = assembly.Title + "_" + assembly.Version;
     }
     client.DefaultRequestHeaders.Clear();
     client.DefaultRequestHeaders.Add("User-Agent", ua);
 }
Exemple #4
0
        /// <summary>
        /// CTOR
        /// </summary>
        public ShellViewModel()
        {
            // Register to events
            EventAggregator.GetEvent <StatusBarMessageUpdateEvent>().Subscribe(OnStatusBarMessageUpdateEvent);

            // Make window title to Assembly title.
            AppAssembly Assembly = new AppAssembly();

            _title      = Assembly.Title;
            _statusText = Assembly.Description;

            Container.Resolve <ILoggerFacade>().Log("ShellViewModel created", Category.Info, Priority.None);
        }
Exemple #5
0
 private void BuildExposedTypes()
 {
     // TODO: add command like option (/expose) to build exposed types
     // load only exposed types
     foreach (var type in AppAssembly.GetReferences(false).SelectMany(asm => asm.GetExposedTypes()))
     {
         if (type.IsTestFixture())
         {
             NUnit.AddFixture(type);
         }
         TypeBuilder.Build(type);
     }
 }
Exemple #6
0
        public ActionResult Index()
        {
            var addinModels = new List <AppAddinModel>();
            var addins      = JcMvc.AddinEngine.GetStartedAddins();

            foreach (var addin in addins)
            {
                AppAddinModel p;
                addinModels.Add(p = new AppAddinModel()
                {
                    Id          = addin.Header.AddinId.Guid.ToString(),
                    Name        = addin.Header.Name,
                    Description = addin.Header.Description,
                });

                var assemblies = addin.Runtime.LoadAssemblies();
                if (assemblies.Length == 0)
                {
                    continue;
                }

                AppAssembly apass        = null;
                Assembly    a            = assemblies[0];
                DateTime    lastModified = DateTime.Now;

                try
                {
                    System.IO.FileInfo fileInfo = new System.IO.FileInfo(a.Location);
                    lastModified = fileInfo.LastWriteTime;
                }
                catch
                {
                }

                apass = new AppAssembly()
                {
                    Name     = a.ManifestModule.Name,
                    CodeBase = a.CodeBase,
                    Version  = a.GetName().Version.ToString(),
                    Date     = lastModified.ToString()
                };

                p.AssemblyInfo = apass;
            }

            //ViewData["AppAddinModel"] = addinModels;

            return(View(addinModels));
        }
Exemple #7
0
        public static string GetDescription()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("编译日期:{0}", AppAssembly.ExecutingAssemblyCompiledDate());
            sb.AppendLine();
            sb.AppendLine();
            sb.AppendLine("运行参数:");
            sb.AppendLine("-i -install   \t安装服务");
            sb.AppendLine("-u -uninstall \t卸载服务");
            sb.AppendLine("-s -silent    \t静默安装或者卸载");
            sb.AppendLine("-start        \t启动服务");
            sb.AppendLine("-stop         \t停止服务");
            sb.AppendLine("-h -? -help   \t显示帮助信息");
            return(sb.ToString());
        }
        /// <summary>
        /// This is routine for the whole app.
        /// Check out <see cref="InitAppRoutine"/> for more details about timing.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimerOnElapsed(object sender, ElapsedEventArgs e)
        {
            // Log it.
            IoC.Logger.Log("Running the app routine.", LogLevel.Debug);

            // Trigger for the next day. New day has come.
            if (mAppRoutineLastRegisteredDate.Day != DateTime.Now.Day)
            {
                // Update the registered date.
                mAppRoutineLastRegisteredDate = DateTime.Now;

                // routine here
            }

            // Active user counter update
            AppAssembly.UpdateActiveUserCounter();
        }
Exemple #9
0
        private static void RunAsWinForm(string[] args)
        {
            var icon = SensorNetwork.Server.Properties.Resources.App;

            SetConsoleIcon(icon.Handle);

            Arguments arg = new Arguments(args);

            AppDomain.CurrentDomain.UnhandledException += new System.UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            bool isSilentInstall = arg.HasProperty("s") || arg.HasProperty("silent");
            bool isStartService  = arg.HasProperty("start");
            bool isStopService   = arg.HasProperty("stop");

            if (arg.HasProperty("i") || arg.HasProperty("install"))
            {
                if (AppAssembly.IsRunAsAdministrator == false)
                {
                    AppAssembly.Restart(true, true);
                    return;
                }
                try
                {
                    Install(false, new string[] { });
                    if (isStartService)
                    {
                        ServiceControl(true, isSilentInstall);
                    }
                    if (isSilentInstall == false)
                    {
                        MessageBox.Show("服务安装成功。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    if (isStartService)
                    {
                        ServiceControl(true, isSilentInstall);
                    }
                    if (isSilentInstall == false)
                    {
                        MessageBox.Show(ex.Message, "安装服务失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else if (arg.HasProperty("u") || arg.HasProperty("uninstall"))
            {
                if (AppAssembly.IsRunAsAdministrator == false)
                {
                    AppAssembly.Restart(true, true);
                    return;
                }
                try
                {
                    Install(true, new string[] { });
                    if (isSilentInstall == false)
                    {
                        MessageBox.Show("服务卸载成功。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    if (isSilentInstall == false)
                    {
                        MessageBox.Show(ex.Message, "卸载服务失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else if (isStartService)
            {
                if (AppAssembly.IsRunAsAdministrator == false)
                {
                    AppAssembly.Restart(true, true);
                    return;
                }
                bool b = ServiceControl(true, isSilentInstall);
                if (b && isSilentInstall == false)
                {
                    MessageBox.Show("服务启动完成。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else if (isStopService)
            {
                if (AppAssembly.IsRunAsAdministrator == false)
                {
                    AppAssembly.Restart(true, true);
                    return;
                }
                bool b = ServiceControl(false, isSilentInstall);
                if (b && isSilentInstall == false)
                {
                    MessageBox.Show("服务停止完成。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else if (arg.HasProperty("?") || arg.HasProperty("h") || arg.HasProperty("help"))
            {
                MessageBox.Show(GetDescription(), "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                Console.Title = string.Format("RD.Server, Started:{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
                InitializeEnvironment();
                try
                {
                    Framework frm = new Framework();
                }
                catch (Exception ex)
                {
                    log.Fatal(ex);

                    if (Environment.UserInteractive)
                    {
                        Console.ReadKey();
                    }
                }
            }
        }
Exemple #10
0
        public ActionResult Index()
        {
            List <AppPlugin> plugins = new List <AppPlugin>();
            Dictionary <string, AppAssembly> asses = new Dictionary <string, AppAssembly>();

            BaseMvcPluginApplication app = BaseMvcPluginApplication.Instance;

            foreach (Lazy <IMvcPlugin, IMvcPluginData> plugin in app.Plugins)
            {
                AppPlugin p;
                plugins.Add(p = new AppPlugin()
                {
                    Id          = plugin.Metadata.Id,
                    Name        = plugin.Metadata.Name,
                    ParentId    = plugin.Metadata.ParentId,
                    Description = plugin.Metadata.Description,
                    Plugin      = plugin.Value
                });

                if (!string.IsNullOrWhiteSpace(p.ParentId))
                {
                    AppPlugin parent = findPlugin(plugins, p.ParentId);
                    if (parent != null)
                    {
                        parent.Children.Add(p);
                    }
                }

                if (plugin.Value != null)
                {
                    AppAssembly apass = null;
                    Assembly    a     = plugin.Value.GetType().Assembly;
                    string      key   = a.CodeBase;
                    if (!asses.ContainsKey(key))
                    {
                        DateTime lastModified = DateTime.Now;
                        try
                        {
                            System.IO.FileInfo fileInfo = new System.IO.FileInfo(a.Location);
                            lastModified = fileInfo.LastWriteTime;
                        }
                        catch (Exception)
                        {
                        }

                        asses[key] = apass = new AppAssembly()
                        {
                            Name = a.ManifestModule.Name, CodeBase = a.CodeBase, Version = a.GetName().Version.ToString(), Date = lastModified.ToString()
                        };
                    }
                    else
                    {
                        apass = asses[key];
                    }

                    p.AssemblyInfo = apass;
                }
            }

            return(View(plugins));
        }