コード例 #1
0
        //-------------------------------------------------------------------------------
        private void m_btnAbout_Click(object sender, EventArgs e)
        {
            AssemblyAttributeAccessors aaa = new AssemblyAttributeAccessors(this);
            string        stringTitle      = aaa.AssemblyTitle;
            FormAboutData formAboutData    = new FormAboutData(
                this,
                new Copyright[] { new Copyright(this, res.Resources.SpringAvestanEditorLogo) },
                new Credits[] { new Credits(stringTitle,
                                            new Credit[] {
                    new Credit(
                        "ArdeshirV",
                        @"ArdeshirV is 'Spring Avestan Editor' founder and developer.
Spring Avestan Editor: https://ardeshirv.github.io/SpringAvestanEditor/
Github: https://github.com/ArdeshirV/SpringAvestanEditor
Email: [email protected]",
                        af.Resources.ArdeshirV)
                }) },
                new Forms.License[] {
                new Forms.License(stringTitle, res.Resources.LICENSE, res.Resources.GPLv3)
            },
                new Donations[] {
                new Donations(stringTitle, DefaultDonationList.Items)
            },
                m_strLink,
                m_strSupportMail);

            FormAbout.Show(formAboutData);
        }
コード例 #2
0
        public override void OnCreate()
        {
            base.OnCreate();

            // A great place to initialize Xamarin.Insights and Dependency Services!

            // конфигурируем приложение
            var container = new UnityContainer();

            Configure(container);

            // start app
            _log?.InfoFormat("====== Start on '{0}'. OS: '{1}'. Ver. '{2} ({3})'.",
                             AndroidUtil.GetDeviceName(),
                             AndroidUtil.GetAndroidVersion(),
                             AppSettings.Default.VersionName,
                             AssemblyAttributeAccessors.GetAssemblyFileVersion(GetType()));

            try
            {
                // json settings
                //http://www.newtonsoft.com/json/help/html/PreserveReferencesHandlingObject.htm
                //http://stackoverflow.com/questions/13510204/json-net-self-referencing-loop-detected
                //https://gist.github.com/carlin-q-scott/4c8a9cce734fa5b10a97
                JsonConvert.DefaultSettings = () => new JsonSerializerSettings
                {
#if DEBUG
                    Formatting = Formatting.Indented,
#endif
                    ContractResolver = ShouldSerializeContractResolver.Instance,
                    TypeNameHandling = TypeNameHandling.Auto
                                       //PreserveReferencesHandling = PreserveReferencesHandling.Objects
                                       //ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                };

                Task.Run(() =>
                {
                    try
                    {
                        var api = new ServiceApi();
                        api.StartService(this, ControlService.ActionAppStart);

                        _log?.Info("------ Init is completed.");
                    }
                    catch (Exception ex)
                    {
                        _log?.Error(ex);
                    }
                });
            }
            catch (Exception ex)
            {
                _log?.Error(ex);
            }
        }
コード例 #3
0
        //---------------------------------------------------------------------
        /// <summary>
        /// Creates copyright class that contains the component's copyright information.
        /// This constructor retrive copyright assembly information
        /// from specified control by reflection.
        /// </summary>
        /// <param name="component">Retrive copyright information from this component</param>
        /// <param name="logo">Component's logo</param>
        public Copyright(object component, Image logo)
        {
            AssemblyAttributeAccessors info = new AssemblyAttributeAccessors(
                Assembly.GetAssembly(component.GetType()));

            _name        = info.AssemblyTitle;
            _logo        = logo;
            _version     = info.AssemblyVersion;
            _company     = info.AssemblyCompany;
            _copyright   = info.AssemblyCopyright;
            _description = info.AssemblyDescription;
        }
コード例 #4
0
        //-------------------------------------------------------------------------------
        private void AddDefaults()
        {
            AssemblyAttributeAccessors aaa = new AssemblyAttributeAccessors(this);

            _donations.Add(aaa.AssemblyTitle, DefaultDonationList.Items);

            _copyrights.Add(aaa.AssemblyTitle, new Copyright(this, Resources.ArdeshirV_Forms_Logo));
            _licenses.Add(aaa.AssemblyTitle, new License("LGPLv3+", Resources.LICENSE, Resources.LGPLv3));
            _credits.Add(aaa.AssemblyTitle, new Credit[] { DefaultCreditList.GetItem("ArdeshirV") });

            aaa = new AssemblyAttributeAccessors(qr.QrCode.Ecc.High);
            _copyrights.Add(aaa.AssemblyTitle, new Copyright(qr.QrCode.Ecc.High, qr.Res.Logo));
            _licenses.Add(aaa.AssemblyTitle, new License("MIT", qr.Res.License, qr.Res.LicenseLogo));
            _credits.Add(aaa.AssemblyTitle, new Credit[] {
                DefaultCreditList.GetItem("ArdeshirV.QrCode"),
                DefaultCreditList.GetItem("Manuel Bleichenbacher"),
                DefaultCreditList.GetItem("Nayuki Project")
            });
        }
コード例 #5
0
        private void StartClientSession()
        {
            //Открываем сессию
            try
            {
                var sessionRegistrator = IoC.Instance.Resolve <ISessionRegistrator>();
                sessionRegistrator.StartNewSession(HostName, ClientType, HostName, IpAddress, MacAddress,
                                                   Session.ToString(CultureInfo.InvariantCulture),
                                                   string.Concat(Environment.UserDomainName, "\\", Environment.UserName),
                                                   AssemblyAttributeAccessors.GetAssemblyFileVersion(Assembly.GetEntryAssembly()),
                                                   WMSEnvironment.Instance.SdclCode,
                                                   Environment.OSVersion.VersionString);
            }
            catch (Exception ex)
            {
                CorrectLogOff();

                _log.Error("Ошибка открытия сессии", ex);
                throw;
            }
        }
コード例 #6
0
ファイル: ErrorBox.xaml.cs プロジェクト: zaharvsb52/MyWmsPro
        private static string CreateMailBody(string header, string message, Exception ex, Dictionary <string, string> currentAdditionalParams)
        {
            var sb = new StringBuilder();

            if (!string.IsNullOrEmpty(header))
            {
                sb.AppendLine(header);
            }

            sb.AppendLine(string.Format("{{cut {0}}}", BugReportResources.TechnicalInfo));
            //sb.AppendLine(BugReportResources.Separator01); //"---------------------------------------------------------"
            //sb.AppendLine(BugReportResources.DontEditThis); //"Внимание! Не редактируйте информацию, приведенную ниже."
            //sb.AppendLine(BugReportResources.Separator01);

            sb.AppendLine(string.Format("{0, -45}{1}", BugReportResources.ClientType, WMSEnvironment.Instance.ClientType));

            sb.AppendLine(string.Format("{0, -28}{1}", BugReportResources.Version, AssemblyAttributeAccessors.GetAssemblyFileVersion(Assembly.GetEntryAssembly())));

            sb.AppendLine(string.Format("{0, -25}{1}", BugReportResources.DotNetVersion, Environment.Version));

            sb.AppendLine(string.Format("{0, -24}{1}", BugReportResources.User, string.Concat(Environment.UserDomainName, "\\", Environment.UserName)));

            var machineName = Environment.MachineName;
            var client      = WMSEnvironment.Instance.ClientCode;

            if (string.IsNullOrEmpty(client))
            {
                client = machineName;
            }
            if (client != machineName)
            {
                sb.AppendLine(string.Format("{0, -24}{1}", BugReportResources.TerminalServer, machineName));
            }

            sb.AppendLine(string.Format("{0, -35}{1}", BugReportResources.ComputerName, client));

            sb.AppendLine(string.Format("{0, -40}{1}", BugReportResources.OsVersion, Environment.OSVersion.VersionString));

            sb.AppendLine(string.Format("{0, -30}{1}", BugReportResources.Time, DateTime.Now));

            sb.AppendLine(string.Empty);

            if (StaticAdditionalParams.Count > 0)
            {
                foreach (var param in StaticAdditionalParams)
                {
                    sb.AppendLine(string.Format("{0}: {1}", param.Key, param.Value));
                }
            }

            if ((currentAdditionalParams != null) && (currentAdditionalParams.Count > 0))
            {
                sb.AppendLine(string.Empty);
                foreach (var param in currentAdditionalParams)
                {
                    sb.AppendLine(string.Format("{0}: {1}", param.Key, param.Value));
                }
            }
            sb.AppendLine(string.Empty);
            sb.AppendLine(BugReportResources.ExceptionMessage).AppendLine(message ?? string.Empty);
            sb.AppendLine(string.Format("{0}:{1}{2}", BugReportResources.Exception, Environment.NewLine, ex));
            sb.AppendLine("{cut}");

            return(sb.ToString());
        }
コード例 #7
0
        //-------------------------------------------------------------------------------
        private void buttonFormAbout_Click(object sender, EventArgs e)
        {
            // AssemblyAttributeAccessors retrive all assembly data by reflection
            AssemblyAttributeAccessors aaa = new AssemblyAttributeAccessors(this);
            string stringAssemblyTitle     = aaa.AssemblyTitle;

            // TODO: You are allowed to add your donation addresses in your code like this:

            /*Donations[] donations = new Donations[] {
             *      new Donations(      // Donations belong to this component and you can specify
             *      stringAssemblyTitle,// several donation lists for several different component in your app
             *      new Donation[] {    // All below donations addresses are linked to
             *                          // the component with stringAssemblyTitle title
             *              new Donation("Bitcoin",                             // Donation name
             *                           "1MjwviitdNC7ndvjXL3dG7mE9Pir3ZBSBP",  // Donation address
             *                   ArdeshirV.Forms.Properties.Resources.Bitcoin), // Donation logo
             *              // if you use usual public cryptocurrency logos like bitcoin and etc...
             *              // then you can refer to ArdeshirV.Forms.Properties.Resources.Bitcoin image
             *              new Donation("Ethereum",  // Here another example about Ethereum
             *                           "0x1DBED0B76d1070a47613EdEE58D9eD8afD6A206D",
             *                           ArdeshirV.Forms.Properties.Resources.Ethereum)
             *      })};*/

            // Adding all my default donation addresses
            Donations[] donations = new Donations[] {
                // Below code add default donation list to donation tab of FormAbout:
                //new Donations(stringAssemblyTitle, DefaultDonationList.Items)
                // You can add your own donation address like this:
                //new Donations("Component Name", new Donation[] {
                //                  new Donation(
                //                      "Bitcoin",                       // Currency type
                //                      "1GtjrxH6t8om8KwHAHKpcG5SAwVSsm4PEi",  // Address
                //                      res.Resources.Bitcoin)  // Currency global symbol
                //              })
            };

            Credits[] credits = new Credits[] {
                new Credits(stringAssemblyTitle, new Credit[] {
                    DefaultCreditList.GetItem("ArdeshirV")
                })
                // TODO: You are allowed to add your credit info in your code like this:
                //new Credits("Component Name", new Credit[] {
                //	            new Credit("Credit Name", "Credit Description...", CreditAvator)
                //	        })
            };

            // You can add your copyright data about your different components like below code
            Copyright[] copyrights = new Copyright[] {
                new Copyright(this, Resources.Logo)                  // the first parameter is
                // one of your components and the Copyright constructor can retrive all
                // assembly data about title, version, copyright and description automatically
                // but you are still able to specify title, version, copyright and description
                // yourself with another constructor like below:
                //, new Copyright(Text, "2.0.0", "Company", "Copyleft", "Test", ImageAppLogo)
                // but I prefer the first professional constructor and I think it's better
                // to specify details about your component in your AssemblyInfo.cs file not here
                // You can use the first kind of constructor only if you set strongname with key
            };

            License[] licenses = new License[] {
                new License(stringAssemblyTitle,                  // The component name
                            Resources.LICENSE,                    // License Contents for specified component
                            Resources.GPLv3)                      // License Logo
            };

            FormAboutData data = new FormAboutData(this,
                                                   copyrights,
                                                   credits,
                                                   licenses,
                                                   donations,
                                                   _stringWebsite,
                                                   _stringEmail);

            FormAbout.Show(data);
        }
コード例 #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_about);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetTitle(Resource.String.AboutTitle);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            _serviceQueue = new Queue <Intent>();
            _tmpFolder    = Path.Combine(FilesDir.Path, AppSettings.TempFolder, AppSettings.LogFilesFolder);
            _productName  = AssemblyAttributeAccessors.GetAssemblyProduct(GetType());
            if (!string.IsNullOrEmpty(_productName))
            {
                _productName = _productName.Replace(".", "_");
            }

            var          assembliesList = new List <string>();
            const string mono           = "mono.android";                        //HARDCODE:
            const string googleLocation = "xamarin.googleplayservices.location"; //HARDCODE:
            const string assformat      = "{0} v.{1}";
            var          names          = new[]
            {
                mono, googleLocation, "log4net", "newtonsoft.json", "nodatime", "sb49.googlegeocoder", "sb49.weather",
                "sb49.provider.darksky", "sb49.provider.openweathermap", "sb49.provider.yahooweather"
            };
            var assemblies =
                AssemblyAttributeAccessors.FindAssemblies(a => names.Contains(a.GetName().Name.ToLower())).ToList();
            string assvers = null;

            if (assemblies.Count > 0)
            {
                void AddVersionHandler(string assname, Func <Assembly, string> getTitleHandler,
                                       Func <string, string> getHardcoreVersionHandler)
                {
                    var ass = assemblies.FirstOrDefault(p => p.GetName().Name.ToLower() == assname);

                    if (ass != null)
                    {
                        var ver = AssemblyAttributeAccessors.GetAssemblyInformationalVersion(ass);
                        assemblies.Remove(ass);
                        if (!string.IsNullOrEmpty(ver))
                        {
                            assembliesList.Add(string.Format(assformat, getTitleHandler(ass),
                                                             getHardcoreVersionHandler == null ? ver : getHardcoreVersionHandler(ver)));
                        }
                    }
                }

                AddVersionHandler(mono, a => a.GetName().Name, null);

                AddVersionHandler(googleLocation, AssemblyAttributeAccessors.GetAssemblyTitle,
                                  v => string.IsNullOrEmpty(v) || v == "1.0.0.0" ? "29.0.0.2" : v); //HARDCODE:

                assembliesList.AddRange(assemblies.Select(p => string.Format(assformat,
                                                                             AssemblyAttributeAccessors.GetAssemblyTitle(p),
                                                                             AssemblyAttributeAccessors.GetAssemblyFileVersion(p)))
                                        .Distinct());

                assvers = "," + System.Environment.NewLine + string.Join(", ", assembliesList);
            }

            _version = string.Format("{0} ({1})", AppSettings.Default.VersionName,
                                     AssemblyAttributeAccessors.GetAssemblyFileVersion(GetType()));
            _versionFull = string.Format("{0}{1}", _version, assvers);

            var version = FindViewById <TextView>(Resource.Id.txtVersion);

            version.Text = _versionFull;

            var copyright = FindViewById <TextView>(Resource.Id.txtCopyright);

            copyright.Text = AssemblyAttributeAccessors.GetAssemblyCopyright(GetType());

            var textFancyWidgets = GetString(Resource.String.IconsCopyRightFancyWidgets);
            var spannable        = new SpannableString(textFancyWidgets);
            var txtFancyWidgets  = FindViewById <TextView>(Resource.Id.txtFancyWidgets);

            txtFancyWidgets.MovementMethod = LinkMovementMethod.Instance;
            spannable.SetSpan(new URLSpan(GetString(Resource.String.IconsCopyRightFancyWidgetsUrl)), 0,
                              textFancyWidgets.Length, SpanTypes.ExclusiveExclusive);
            txtFancyWidgets.TextFormatted = spannable;

            var textYandexWeather = GetString(Resource.String.IconsCopyRightYandexWeather);

            spannable = new SpannableString(textYandexWeather);
            var txtYandexWeather = FindViewById <TextView>(Resource.Id.txtYandexWeather);

            txtYandexWeather.MovementMethod = LinkMovementMethod.Instance;
            spannable.SetSpan(new URLSpan(GetString(Resource.String.IconsCopyRightYandexWeatherUrl)), 0,
                              textYandexWeather.Length, SpanTypes.ExclusiveExclusive);
            txtYandexWeather.TextFormatted = spannable;

            _viewProgressbar = FindViewById(Resource.Id.toolbarProgress);
        }
コード例 #9
0
 public SplashScreenViewModel()
 {
     AttributeAccessors = new AssemblyAttributeAccessors();
 }
コード例 #10
0
        private void SendMail()
        {
            try
            {
                var sb = new StringBuilder();
                sb.AppendLine(BugReportResources.MessageToUser);
                sb.AppendLine("1. ");
                sb.AppendLine("2. ");
                sb.AppendLine("... ");
                sb.AppendLine(Environment.NewLine);
                sb.AppendLine(string.Format("{{cut {0}}}", BugReportResources.TechnicalInfo));
                sb.AppendLine(BugReportResources.Separator01);  //"---------------------------------------------------------"
                sb.AppendLine(BugReportResources.DontEditThis); //"Внимание! Не редактируйте информацию, приведенную ниже."
                sb.AppendLine(BugReportResources.Separator01);

                sb.AppendLine(string.Format("{0, -27}{1}", BugReportResources.Version, AssemblyAttributeAccessors.GetAssemblyFileVersion(Assembly.GetEntryAssembly())));

                sb.AppendLine(string.Format("{0, -24}{1}", BugReportResources.DotNetVersion, Environment.Version));

                sb.AppendLine(string.Format("{0, -24}{1}", BugReportResources.User, string.Concat(Environment.UserDomainName, "\\", Environment.UserName)));

                var machineName = Environment.MachineName;
                var client      = WMSEnvironment.Instance.ClientCode;
                if (string.IsNullOrEmpty(client))
                {
                    client = machineName;
                }
                if (client != machineName)
                {
                    sb.AppendLine(string.Format("{0, -24}{1}", BugReportResources.TerminalServer, machineName));
                }
                sb.AppendLine(string.Format("{0, -35}{1}", BugReportResources.ComputerName, Environment.MachineName));

                sb.AppendLine(string.Format("{0, -40}{1}", BugReportResources.OsVersion, Environment.OSVersion.VersionString));

                sb.AppendLine(string.Format("{0, -30}{1}", BugReportResources.Time, DateTime.Now));

                sb.AppendLine(string.Empty);
                if (SelectedItem != null)
                {
                    sb.AppendLine(string.Format("{0}: {1}", BugReportResources.MandantCode, SelectedItem.MandantCode));
                }

                if (StaticAdditionalParams.Count > 0)
                {
                    foreach (var param in StaticAdditionalParams)
                    {
                        sb.AppendLine(string.Format("{0}: {1}", param.Key, param.Value));
                    }
                }

                if ((CurrentAdditionalParams != null) && (CurrentAdditionalParams.Count > 0))
                {
                    sb.AppendLine(string.Empty);
                    foreach (var param in CurrentAdditionalParams)
                    {
                        sb.AppendLine(string.Format("{0}: {1}", param.Key, param.Value));
                    }
                }
                sb.AppendLine(string.Empty);
                sb.AppendLine(BugReportResources.ExceptionMessage).AppendLine(Message ?? string.Empty);
                sb.AppendLine(string.Format("{0}:{1}{2}", BugReportResources.Exception, Environment.NewLine, Exception));
                sb.AppendLine("{cut}");

                Mapi.SendMail(
                    HelpServiceMail,
                    string.Empty,
                    string.Format(ErrorMessageSubjectTemplate, AssemblyAttributeAccessors.AssemblyProduct),
                    sb.ToString(),
                    Attachments,
                    true);
            }
            catch (Exception ex)
            {
                Close();
                //ShowError("Невозможно отправить письмо в службу технической поддержки", ex, false);
                ShowError(message: BugReportResources.UnableSendEmailToSupport, ex: ex, additionalParams: null,
                          attachments: null, isBtnSandMailEnable: false,
                          mandantCode: SelectedItem == null ? null : SelectedItem.MandantCode);
            }
        }