Пример #1
0
        public MainForm()
        {
            try
            {
                FluentSplashScreenOptions fluentSplashScreenOptions = new FluentSplashScreenOptions();
                fluentSplashScreenOptions.Title                = "Were Desktop";
                fluentSplashScreenOptions.Subtitle             = "";
                fluentSplashScreenOptions.RightFooter          = "Starting....";
                fluentSplashScreenOptions.LeftFooter           = $"Copyright 2021 {Environment.NewLine}All Rights reserved.";
                fluentSplashScreenOptions.LoadingIndicatorType = FluentLoadingIndicatorType.Dots;
                fluentSplashScreenOptions.OpacityColor         = Color.FromArgb(0, 136, 202);
                fluentSplashScreenOptions.Opacity              = 255;
                fluentSplashScreenOptions.AppearanceLeftFooter.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
                SplashScreenManager.ShowFluentSplashScreen(fluentSplashScreenOptions, parentForm: this, useFadeIn: true, useFadeOut: true);

                InitializeComponent();
                this.WindowState = FormWindowState.Minimized;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                //closing splash screen
                SplashScreenManager.CloseForm(false, 3000, this);
                Thread.Sleep(3800);
                this.WindowState = FormWindowState.Maximized;
            }
        }
Пример #2
0
        private void ShowSplashScreen()
        {
            using var op = new FluentSplashScreenOptions
                  {
                      Title                = "Spread Commander 2022",
                      Subtitle             = "Office Tools & Data Analysis",
                      RightFooter          = "Starting ...",
                      LeftFooter           = "Viatcheslav V. Vassiliev\r\nCopyright © Since 2019\r\nAll Rights reserved.",
                      LoadingIndicatorType = FluentLoadingIndicatorType.Dots,
                      OpacityColor         = Color.DarkBlue,
                      Opacity              = 150
                  };
            op.AppearanceTitle.Font            = new Font("Times New Roman", 40, FontStyle.Bold | FontStyle.Italic | FontStyle.Underline);
            op.AppearanceTitle.ForeColor       = Color.LightGoldenrodYellow;
            op.AppearanceSubtitle.Font         = new Font("Times New Roman", 24, FontStyle.Italic);
            op.AppearanceSubtitle.ForeColor    = Color.AntiqueWhite;
            op.AppearanceLeftFooter.Font       = new Font("Times New Roman", 12, FontStyle.Italic);
            op.AppearanceLeftFooter.ForeColor  = Color.AntiqueWhite;
            op.AppearanceRightFooter.Font      = new Font("Lucida Console", 12);
            op.AppearanceRightFooter.ForeColor = Color.AntiqueWhite;

            op.LogoImageOptions.Image = Utils.GetEmbeddedResourceImage(GetType().Assembly, "Images.Logo.png");
            if (op.LogoImageOptions.Image is Bitmap bmpLogo)
            {
                bmpLogo.MakeTransparent();
            }

            DevExpress.XtraSplashScreen.SplashScreenManager.ShowFluentSplashScreen(
                op,
                parentForm: this,
                useFadeIn:  true,
                useFadeOut: true,
                startPos:   SplashFormStartPosition.CenterScreen
                );
        }
Пример #3
0
        public LoginFrm()
        {
            FluentSplashScreenOptions fluent = new FluentSplashScreenOptions();

            fluent.Title = "Task Management App";
            //fluent.Subtitle = "Test Test";
            SplashScreenManager.ShowFluentSplashScreen(fluent, parentForm: this, useFadeIn: true, useFadeOut: true);

            InitializeComponent();

            SplashScreenManager.CloseForm(false, SplashScreenTime, this);
        }
Пример #4
0
        public Form1()
        {
            FluentSplashScreenOptions options = new FluentSplashScreenOptions();

            options.Title                = "Daedalus is back";
            options.Subtitle             = "subtitle";
            options.RightFooter          = "Right footer";
            options.LoadingIndicatorType = FluentLoadingIndicatorType.Ring;
            options.Opacity              = 130;
            // options.OpacityColor = Color.DarkGreen;
            options.OpacityColor = Color.SeaGreen;
            SplashScreenManager.ShowFluentSplashScreen(options, useFadeIn: true, useFadeOut: true);
            System.Threading.Thread.Sleep(2000);
            InitializeComponent();
            SplashScreenManager.CloseForm();
        }
        private async void ShowLoadForm()
        {
            var op = new FluentSplashScreenOptions
            {
                Opacity     = 100,
                Title       = $"Hi ~ 【{GlobalCache.Admin.AdminName}】,欢迎回来!",
                Subtitle    = "正在为您加载数据,请稍后!",
                RightFooter = "Starting...",
                LeftFooter  =
                    $"Copyright © 2021.1 - 2021.2 XIANG HAO.{Environment.NewLine} All Rights reserved.",
                LoadingIndicatorType = FluentLoadingIndicatorType.Dots,
                OpacityColor         = Color.Gray,
                LogoImageOptions     =
                {
                    SvgImage                 = SvgImage.FromFile(AppDomain.CurrentDomain.BaseDirectory + "/Resource/管理员.svg"),
                    SvgImageColorizationMode = SvgImageColorizationMode.Default,                                              SvgImageSize= new Size(60, 60)
                }
            };

            this.Hide();
            SplashScreenManager.ShowFluentSplashScreen(
                op,
                parentForm: this,
                useFadeIn: true,
                useFadeOut: true
                );
            var admin = await _api.GetAdminInfo(new Admin
                                                { AdminName = GlobalCache.Admin.AdminName, AdminPassword = GlobalCache.Admin.AdminPassword });

            GlobalCache.Admin = admin;
            Thread.Sleep(2500);

            //关闭加载窗体
            SplashScreenManager.CloseForm();

            new FrmMain().Show();
        }
Пример #6
0
        public Form1()
        {
            #region Serilog initial
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .WriteTo.File($"{AppDomain.CurrentDomain.BaseDirectory}\\log\\log-.txt",
                                       rollingInterval: RollingInterval.Day,
                                       outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}")
                         .CreateLogger();       //宣告Serilog初始化
            #endregion

            #region Loading initial
            FluentSplashScreenOptions op = new FluentSplashScreenOptions();
            op.Title                = "太陽能資料蒐集系統";//太陽能資料蒐集系統  帆宣自動化抄表系統
            op.Subtitle             = "Automatic Meter Reading System";
            op.LeftFooter           = "Copyright © 2021 SIN MAO Energy CO., LTD." + Environment.NewLine + "All Rights reserved.";
            op.LoadingIndicatorType = FluentLoadingIndicatorType.Dots;
            op.OpacityColor         = Color.FromArgb(62, 91, 135);
            op.Opacity              = 130;
            SplashScreenManager.ShowFluentSplashScreen(
                op,
                parentForm: this,
                useFadeIn: true,
                useFadeOut: true
                );
            #endregion

            #region  入資料庫JSON
            op.RightFooter = $"載入資料庫資訊";
            SplashScreenManager.Default.SendCommand(FluentSplashScreenCommand.UpdateOptions, op);
            SystemSetting = InitialMethod.SystemLoad();
            Thread.Sleep(1000);
            #endregion

            #region  入按鈕JSON
            op.RightFooter = $"載入按鈕資訊";
            SplashScreenManager.Default.SendCommand(FluentSplashScreenCommand.UpdateOptions, op);
            ButtonSetting = InitialMethod.InitialButtonLoad();
            Thread.Sleep(1000);
            #endregion

            #region  入匯出報表JSON
            op.RightFooter = $"載入匯出報表資訊";
            SplashScreenManager.Default.SendCommand(FluentSplashScreenCommand.UpdateOptions, op);
            XtraReportSetting = InitialMethod.InitialXtraReportLoad();

            Thread.Sleep(1000);
            #endregion

            #region JSON錯誤資訊檢查
            if (SystemSetting == null && ButtonSetting == null && XtraReportSetting == null)
            {
                ErrorStr = "資料庫與按鈕Json錯誤";
            }
            else if (SystemSetting != null && ButtonSetting == null && XtraReportSetting != null)
            {
                ErrorStr = "按鈕Json錯誤";
            }
            else if (SystemSetting == null && ButtonSetting != null && XtraReportSetting != null)
            {
                ErrorStr = "資料庫Json錯誤";
            }
            else if (SystemSetting != null && ButtonSetting != null && XtraReportSetting == null)
            {
                ErrorStr = "匯出報表Json錯誤";
            }
            if (ErrorStr == "")
            {
                op.RightFooter = $"載入完成";
                SplashScreenManager.Default.SendCommand(FluentSplashScreenCommand.UpdateOptions, op);
                Thread.Sleep(1000);
                SplashScreenManager.CloseForm();
            }
            else
            {
                op.RightFooter = $"{ErrorStr}";
                SplashScreenManager.Default.SendCommand(FluentSplashScreenCommand.UpdateOptions, op);
                Thread.Sleep(5000);
                SplashScreenManager.CloseForm();
            }
            #endregion

            InitializeComponent();
            if (ErrorStr == "")
            {
                Change_Logo();                                                                   //載入Logo
                SettingbarButtonItem.ImageOptions.Image = imageCollection1.Images["technology"]; //設定按鈕圖
                #region 建立資料庫物件
                MysqlMethod = new MysqlMethod(SystemSetting);
                if (SystemSetting != null)
                {
                    GatewayConfigs = MysqlMethod.Search_GatewayConfig();
                }
                #endregion

                #region 建立通訊
                if (GatewayConfigs != null)
                {
                    foreach (var item in GatewayConfigs)
                    {
                        GatewayTypeEnum gatewayType = (GatewayTypeEnum)item.GatewayTypeEnum;
                        switch (gatewayType)
                        {
                        case GatewayTypeEnum.ModbusRTU:
                        {
                            SerialportMasterComponent serialport = new SerialportMasterComponent(item, MysqlMethod)
                            {
                                MysqlMethod = MysqlMethod
                            };
                            serialport.MyWorkState = true;
                            Field4Components.Add(serialport);
                        }
                        break;

                        case GatewayTypeEnum.ModbusTCP:
                        {
                            TCPMasterComponent TCP = new TCPMasterComponent(item, MysqlMethod)
                            {
                                MysqlMethod = MysqlMethod
                            };
                            TCP.MyWorkState = true;
                            Field4Components.Add(TCP);
                        }
                        break;
                        }
                    }
                }
                #endregion

                #region 建立按鈕物件
                NavigationFrame = new NavigationFrame()
                {
                    Dock = DockStyle.Fill
                };
                NavigationFrame.Parent = ViewpanelControl;
                ButtonMethod           = new ButtonMethod()
                {
                    Form1 = this, navigationFrame = NavigationFrame
                };
                ButtonMethod.AccordionLoad(accordionControl1, ButtonSetting);
                #endregion

                #region 建立畫面
                foreach (var Componentitem in Field4Components)
                {
                    foreach (var Absprotocolitem in Componentitem.ElectricAbsProtocols)
                    {
                        ElectricAbsProtocols.Add(Absprotocolitem);
                    }
                }
                #region 主畫面
                MainUserControl main = new MainUserControl(MysqlMethod, ElectricAbsProtocols)
                {
                    Dock = DockStyle.Fill
                };
                NavigationFrame.AddPage(main);
                Field4UserControls.Add(main);
                #endregion
                #region 報表畫面
                ChartUserControl chart = new ChartUserControl(MysqlMethod)
                {
                    Dock = DockStyle.Fill
                };
                NavigationFrame.AddPage(chart);
                Field4UserControls.Add(chart);
                #endregion
                #region 月報表畫面
                xtraReportUserControl = new XtraReportUserControl(MysqlMethod)
                {
                    Dock = DockStyle.Fill
                };
                NavigationFrame.AddPage(xtraReportUserControl);
                #endregion
                #endregion
            }
            timer1.Interval = 1000;
            timer1.Enabled  = true;
        }