gFinger 손끝으로 만드는 세상

 

Table Of Contens


1. How to embedded resource로 등록하기

2. nuget package 추가

3. embeded resource를 읽어서 sound 출력

4. 참조
 

 

 1. embedded resource로 등록하기

  - Sound 폴더를 프로젝트에 생성하고 mp3 파일을 등록

 - mp3 파일을 embedded resource로 등록

   솔루션 탐색기 -> 속성에서

embeded resource로 등록하기

 

embeded resource 속성

 

2.  nuget package 추가

https://github.com/adrianstevens/Xamarin-Plugins/tree/master/SimpleAudioPlayer

 

adrianstevens/Xamarin-Plugins

Cross-platform Plugins for Xamarin, Xamarin.Forms and Windows - adrianstevens/Xamarin-Plugins

github.com

 

3. embedded resource를 읽어서 sound 출력

 - sound 출력 class example

    class PlaySoundClass
    {
        ISimpleAudioPlayer soundBreath = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;
        ISimpleAudioPlayer soundHold = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;
        PlaySoundClass()
        {
            Stream stream;
            stream = GetDeviceInfo.GetStearmFromEmbededResource("Sound", "Breathe.mp3");
            soundBreath.Load(stream);
            stream = GetDeviceInfo.GetStearmFromEmbededResource("Sound", "HoldYourBreath.mp3");
            soundBreath.Load(stream);
        } 

        public void PlayBreahSound()
        {
            soundBreath.Play();
        }

        public void PlayHoldSound()
        {
            soundHold.Play();
        }
    }

- embedded resource read example

    public static class GetDeviceInfo
    {

        public static Stream GetStearmFromEmbededResource(string FolderName, string fileName)
        {
            TypeInfo PageInfo = typeof(GetDeviceInfo).GetTypeInfo();
            Assembly assembly = PageInfo.Assembly;

            Stream abc = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.{FolderName}.{fileName}");
            return abc;
        }
     }

4. 참조

https://www.colabug.com/2017/1114/1884556/

 

Adding Sound to a Xamarin.Forms App – CoLaBug.com

Audio has many uses in mobile applications. Sounds can be essential to your app; they may notify users of important events or make your app accessible to visually-impaired users. We can also use sound to help convey moods, intentions, or feelings within ou

www.colabug.com

 

Table Of Contens

1. Code

2. Reference

 

 

1. Code


 

        {
            InitializeComponent();

            # region Tap Event Handler

            TapGestureRecognizer objTapGestureRecognizer = new TapGestureRecognizer();
            objTapGestureRecognizer.Tapped += ((o2, e2) =>
            {
                OnDismissButtonClicked();
            });

            this.Content.GestureRecognizers.Add(objTapGestureRecognizer);

            #endregion
        }
        
        async void OnDismissButtonClicked( )
        {
            ....
        }

 

 

2. Reference


 

https://stackoverflow.com/questions/26566375/how-to-add-a-click-handler-to-content-page-in-xamarin-forms

 

How to add a click handler to content page in xamarin forms

I am new at Xamarin.Forms and are trying to add a click event to my content page. I want an event to start when the user clicks on the page, no matter where. I've created similar functionality in a

stackoverflow.com

 

 

 

 

Table Of Contens

1. Class Example

2. Reference

1. Example

 
  class ProcessingSVG
    {
        public List SVGlist = new List();

        // SVG를 처리하는 Class
        public class SvgClass
        {   
            private SkiaSharp.Extended.Svg.SKSvg svg;  

           
            // Get file .svg to folder Images 
            // Form Embeded Resoure 
            Stream GetImageStream(string svgName, Type PageType)
            {

                TypeInfo PageInfo = PageType.GetTypeInfo();
                Assembly assembly = PageInfo.Assembly;

                var abc = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.Images.{svgName}");
                return abc;
            }
 

            //  return picture of the SVG
            public SKPicture GetPicture()
            {
                return svg.Picture;
            }

            public void LoadSvg(string svgName, Type PageType)
            {
                // create a new SVG object
                svg = new SkiaSharp.Extended.Svg.SKSvg(); 
                // load the SVG document from a stream 
                using (var stream = GetImageStream(svgName, PageType))
                    svg.Load(stream);
            }
        } 
    }
    
    
    
        // Save  SVG File 
        ProcessingSVG XX_SVG = new ProcessingSVG();
        const int NumberOfSVG = 10;
        void LoadSVGimage()
        {
            // Data Exist
            if (XX_SVG.SVGlist != null) XX_SVG.SVGlist.Clear();

            for(int i=0; i< NumberOfSVG; i++)
            {
                var oneSVG = new ProcessingSVG.SvgClass();
                oneSVG.LoadSvg("test"+i.ToString()+".svg", typeof(MainPage));
                XX_SVG.SVGlist.Add(oneSVG); 
            } 
        }
        

       // Draw SVG Picture
          canvasXX.Save();
          canvasXX.Scale(0.1f); 
          canvasXX.DrawPicture(XX_SVG.SVGlist[7].GetPicture(), 0,0);
          canvasXX.Restore();
          
          

 

2. Reference


https://stackoverflow.com/questions/58259473/how-to-load-file-svg-with-skiasharp-on-xamarin-forms

 

Table Of Contens

1. SkShader Class Example

2. Reference

 

1. SkShader Class Example

 
        public void FillSpotGradient(SKCanvas canvas, float width, float height)
        {
            float selectedSize = Math.Min(width, height);


                // create the shader
                var colors = new SKColor[]
                {
                    new SKColor(0, 255, 255),
                    new SKColor(255, 0, 255),
                    new SKColor(255, 255, 0),
                    new SKColor(0, 255, 255)
                };
                var shader = SKShader.CreateSweepGradient
                (
                    new SKPoint(width / 3, height / 3),
                    colors,
                    null
                );

                // use the shader
                var paint = new SKPaint
                {
                    Shader = shader
                };
                canvas.DrawPaint(paint); 
        }

 

2. Reference


https://docs.microsoft.com/en-us/dotnet/api/skiasharp.skshader?view=skiasharp-1.68.1

 

SKShader Class (SkiaSharp)

Shaders specify the source color(s) for what is being drawn in the .

docs.microsoft.com

 

 

지원되는 소프트웨어 제품

마이그레이션 도구는 다음 프로젝트 (버전 기준)의 마이그레이션을 지원합니다.

  • STEP 7 Professional 2010
  • STEP 7 V5.5
  • WinCC V7.2
  • WinCC flexible 2008 SP2 / SP3 / SP5
  • Distributed Safety V5.4

WINCC Project를 TIA Portal로 Migration하기 위한 Install File

https://support.industry.siemens.com/cs/document/58638200/migration-tool-tia-portal?dti=0&lc=en-WW

SIMATIC_Migration_Tool_TIA_V15_1_Upd3.exe