public void MakeEnumIfNecessary()
        {
            if (EnumOptions is null)
            {
                return;
            }
            var en = new CsEnum(ShortTypeName);

            foreach (var i in EnumOptions.Items)
            {
                en.Items.Add(new CsEnumItem(i.CsValue));
            }
            TargetNamespace.AddEnum(en);
        }
Пример #2
0
        public XCompileAttribute(string bindingLanguageAssembly, string sourceFile)
        {
            // load import language assembly via reflection
            Assembly assembly = Assembly.Load(bindingLanguageAssembly);
            Type     type     = assembly.GetType(bindingLanguageAssembly + ".BindingLanguage");

            Language    = (ABindingLanguage)Activator.CreateInstance(type);
            _sourceFile = sourceFile;
            // verify committed values
            if (TargetNamespace == null || TargetNamespace.Equals(string.Empty))
            {
                TargetNamespace = bindingLanguageAssembly;
            }
            if (_sourceFile == null || _sourceFile.Equals(string.Empty))
            {
                throw new XCompileException("Invalid source file path!");
            }
        }
Пример #3
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            #line 1 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"

// =========================================================================
// Copyright 2019 EPAM Systems, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =========================================================================


            #line default
            #line hidden
            this.Write("#nullable enable\r\n\r\n");
            this.Write(@"using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using FlexiMvvm.Persistence.Core;
using FlexiMvvm.ViewModels;
using FlexiMvvm.Views.Core;
");

            #line 35 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
            foreach (var viewGenerationOptions in ViewsGenerationOptions)
            {
            #line default
            #line hidden
                this.Write("\r\nnamespace ");

            #line 37 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(GetNamespace(viewGenerationOptions)));

            #line default
            #line hidden
                this.Write("\r\n{\r\n    /// <summary>\r\n    /// Represents a/an <see cref=\"");

            #line 40 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.BaseClassName));

            #line default
            #line hidden
                this.Write("\"/> that is adapted for use with the FlexiMvvm.\r\n    /// </summary>\r\n    [Registe" +
                           "r(\"");

            #line 42 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(TargetNamespace.ToLower()));

            #line default
            #line hidden
                this.Write(".");

            #line 42 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("\")]\r\n    public partial class ");

            #line 43 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(" : ");

            #line 43 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.BaseClassName));

            #line default
            #line hidden
                this.Write(", IAndroidView, IOptionsMenuSource\r\n    {\r\n        private IViewLifecycleDelegate" +
                           "? _lifecycleDelegate;\r\n\r\n        /// <inheritdoc />\r\n        public ");

            #line 48 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("()\r\n        {\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        protected ");

            #line 53 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(@"(IntPtr javaReference, JniHandleOwnership transfer)
            : base(javaReference, transfer)
        {
        }

        /// <inheritdoc />
        public event EventHandler<OptionsItemSelectedEventArgs> OnOptionsItemSelectedCalled;

        /// <summary>
        /// Gets the view lifecycle delegate. Intended for internal use by the FlexiMvvm.
        /// </summary>
        protected IViewLifecycleDelegate LifecycleDelegate => _lifecycleDelegate ??= CreateLifecycleDelegate();

        /// <summary>
        /// Creates a new <see cref=""IViewLifecycleDelegate""/> instance. Intended for internal use by the FlexiMvvm.
        /// </summary>
        protected virtual IViewLifecycleDelegate CreateLifecycleDelegate()
        {
            return new ViewLifecycleDelegate<");

            #line 71 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(">(this);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        ");

            #line 75 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnCreate(Bundle? savedInstanceState)\r\n        {\r\n            base." +
                           "OnCreate(savedInstanceState);\r\n\r\n            LifecycleDelegate.OnCreate(savedIns" +
                           "tanceState);\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        ");

            #line 83 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnStart()\r\n        {\r\n            base.OnStart();\r\n\r\n            L" +
                           "ifecycleDelegate.OnStart();\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        ");

            #line 91 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnResume()\r\n        {\r\n            base.OnResume();\r\n\r\n           " +
                           " LifecycleDelegate.OnResume();\r\n        }\r\n\r\n        /// <inheritdoc />\r\n       " +
                           " ");

            #line 99 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnPause()\r\n        {\r\n            base.OnPause();\r\n\r\n            L" +
                           "ifecycleDelegate.OnPause();\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        ");

            #line 107 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(@" override void OnStop()
        {
            base.OnStop();

            LifecycleDelegate.OnStop();
        }

        /// <inheritdoc />
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            var optionsItemSelectedEventArgs = new OptionsItemSelectedEventArgs(item);
            OnOptionsItemSelectedCalled?.Invoke(this, optionsItemSelectedEventArgs);

            if (optionsItemSelectedEventArgs.Handled)
            {
                return true;
            }

            return base.OnOptionsItemSelected(item);
        }

        /// <inheritdoc />
        ");

            #line 129 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnActivityResult(int requestCode, ");

            #line 129 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ResultCodeTypeName));

            #line default
            #line hidden
                this.Write(@" resultCode, Intent? data)
        {
            LifecycleDelegate.OnActivityResult(requestCode, (Android.App.Result)resultCode, data);

            base.OnActivityResult(requestCode, resultCode, data);
        }

        /// <inheritdoc />
        ");

            #line 137 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnSaveInstanceState(Bundle outState)\r\n        {\r\n            Lifec" +
                           "ycleDelegate.OnSaveInstanceState(outState);\r\n\r\n            base.OnSaveInstanceSt" +
                           "ate(outState);\r\n        }\r\n");

            #line 143 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                if (viewGenerationOptions.Kind == ViewKind.Fragment)
                {
            #line default
            #line hidden
                    this.Write("\r\n        /// <inheritdoc />\r\n        public override void OnDestroyView()\r\n     " +
                               "   {\r\n            LifecycleDelegate.OnDestroyView();\r\n\r\n            base.OnDestr" +
                               "oyView();\r\n        }\r\n");

            #line 152 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                }

            #line default
            #line hidden
                this.Write("\r\n        /// <inheritdoc />\r\n        ");

            #line 155 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnDestroy()\r\n        {\r\n            LifecycleDelegate.OnDestroy();" +
                           "\r\n\r\n            base.OnDestroy();\r\n        }\r\n    }\r\n\r\n    /// <summary>\r\n    //" +
                           "/ Represents a/an <see cref=\"");

            #line 164 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.BaseClassName));

            #line default
            #line hidden
                this.Write(@"""/> that is adapted for use with the FlexiMvvm
    /// and has its own lifecycle-aware view model.
    /// </summary>
    /// <typeparam name=""TViewModel"">The type of the view model.</typeparam>
    [SuppressMessage(
        ""Compiler"",
        ""CS8618:Non-nullable field is uninitialized."",
        Justification = ""The view lifecycle delegate sets a value to the ViewModel property so it is not null starting from OnCreate method."")]
    public partial class ");

            #line 172 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("<TViewModel> : ");

            #line 172 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(", INavigationView<TViewModel>, ILifecycleViewModelOwner<TViewModel>\r\n        wher" +
                           "e TViewModel : class, ILifecycleViewModelWithoutParameters, IStateOwner\r\n    {\r\n" +
                           "        private RequestCode? _requestCode;\r\n\r\n        /// <inheritdoc />\r\n      " +
                           "  public ");

            #line 178 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("()\r\n        {\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        protected ");

            #line 183 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(@"(IntPtr javaReference, JniHandleOwnership transfer)
            : base(javaReference, transfer)
        {
        }

        /// <inheritdoc />
        public TViewModel ViewModel { get; private set; }

        /// <inheritdoc />
        public RequestCode RequestCode => _requestCode ??= new RequestCode();

        /// <inheritdoc />
        protected override IViewLifecycleDelegate CreateLifecycleDelegate()
        {
            return new ViewLifecycleDelegate<");

            #line 197 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("<TViewModel>, TViewModel>(this);\r\n        }\r\n");

            #line 199 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                if (viewGenerationOptions.Kind == ViewKind.Fragment)
                {
            #line default
            #line hidden
                    this.Write(@"
        /// <inheritdoc />
        /// <exception cref=""NotSupportedException"">The fragment cannot set a result. Use the appropriate method of fragment's activity instead.</exception>
        public void SetResult(Android.App.Result resultCode, Intent? data)
        {
            throw new NotSupportedException(""The fragment cannot set a result. Use the appropriate method of fragment's activity instead."");
        }

        /// <inheritdoc />
        /// <exception cref=""NotSupportedException"">The fragment cannot finish an activity. Use the appropriate method of fragment's activity instead.</exception>
        public void Finish()
        {
            throw new NotSupportedException(""The fragment cannot finish an activity. Use the appropriate method of fragment's activity instead."");
        }
");

            #line 214 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                }

            #line default
            #line hidden
                this.Write(@"
        void ILifecycleViewModelOwner<TViewModel>.SetViewModel(TViewModel viewModel)
        {
            ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
        }

        async Task ILifecycleViewModelOwner<TViewModel>.InitializeViewModelAsync(bool recreated)
        {
            await ViewModel.InitializeAsync(recreated);
        }
    }

    /// <summary>
    /// Represents a/an <see cref=""");

            #line 228 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.BaseClassName));

            #line default
            #line hidden
                this.Write(@"""/> that is adapted for use with the FlexiMvvm,
    /// has its own lifecycle-aware view model and takes lifecycle-aware view model parameters.
    /// </summary>
    /// <typeparam name=""TViewModel"">The type of the view model.</typeparam>
    /// <typeparam name=""TParameters"">The type of the view model parameters.</typeparam>
    [SuppressMessage(
        ""Compiler"",
        ""CS8618:Non-nullable field is uninitialized."",
        Justification = ""The view lifecycle delegate sets a value to the ViewModel property so it is not null starting from OnCreate method."")]
    public partial class ");

            #line 237 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("<TViewModel, TParameters> : ");

            #line 237 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(@", INavigationView<TViewModel>, ILifecycleViewModelOwner<TViewModel>
        where TViewModel : class, ILifecycleViewModelWithParameters<TParameters>, IStateOwner
        where TParameters : Parameters
    {
        private RequestCode? _requestCode;

        /// <inheritdoc />
        public ");

            #line 244 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("()\r\n        {\r\n        }\r\n\r\n        /// <inheritdoc />\r\n        protected ");

            #line 249 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(@"(IntPtr javaReference, JniHandleOwnership transfer)
            : base(javaReference, transfer)
        {
        }

        /// <inheritdoc />
        public TViewModel ViewModel { get; private set; }

        /// <inheritdoc />
        public RequestCode RequestCode => _requestCode ??= new RequestCode();

        /// <inheritdoc />
        protected override IViewLifecycleDelegate CreateLifecycleDelegate()
        {
            return new ViewLifecycleDelegate<");

            #line 263 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("<TViewModel, TParameters>, TViewModel>(this);\r\n        }\r\n");

            #line 265 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                if (viewGenerationOptions.Kind == ViewKind.Fragment)
                {
            #line default
            #line hidden
                    this.Write(@"
        /// <inheritdoc />
        /// <exception cref=""NotSupportedException"">The fragment cannot set a result. Use the appropriate method of fragment's activity instead.</exception>
        public void SetResult(Android.App.Result resultCode, Intent? data)
        {
            throw new NotSupportedException(""The fragment cannot set a result. Use the appropriate method of fragment's activity instead."");
        }

        /// <inheritdoc />
        /// <exception cref=""NotSupportedException"">The fragment cannot finish an activity. Use the appropriate method of fragment's activity instead.</exception>
        public void Finish()
        {
            throw new NotSupportedException(""The fragment cannot finish an activity. Use the appropriate method of fragment's activity instead."");
        }
");

            #line 280 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                }

            #line default
            #line hidden
                this.Write(@"
        void ILifecycleViewModelOwner<TViewModel>.SetViewModel(TViewModel viewModel)
        {
            ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
        }

        async Task ILifecycleViewModelOwner<TViewModel>.InitializeViewModelAsync(bool recreated)
        {
            await ViewModel.InitializeAsync(");

            #line 289 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ParametersSourceName));

            #line default
            #line hidden
                this.Write("?.GetParameters<TParameters>(), recreated);\r\n        }\r\n    }\r\n}\r\n\r\n");

            #line 294 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
            }

            #line default
            #line hidden
            this.Write("#nullable restore\r\n");
            return(this.GenerationEnvironment.ToString());
        }
Пример #4
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            #line 1 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"

// =========================================================================
// Copyright 2019 EPAM Systems, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =========================================================================


            #line default
            #line hidden
            this.Write(@"using System;
using System.Threading.Tasks;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using FlexiMvvm.Persistence.Core;
using FlexiMvvm.ViewModels;
using FlexiMvvm.ViewModels.Core;
using FlexiMvvm.Views.Core;
");

            #line 33 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
            foreach (var viewGenerationOptions in ViewsGenerationOptions)
            {
            #line default
            #line hidden
                this.Write("\r\nnamespace ");

            #line 35 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(GetNamespace(viewGenerationOptions)));

            #line default
            #line hidden
                this.Write("\r\n{\r\n    [Register(\"");

            #line 37 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(TargetNamespace.ToLower()));

            #line default
            #line hidden
                this.Write(".");

            #line 37 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("\")]\r\n    public partial class ");

            #line 38 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(" : ");

            #line 38 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.BaseClassName));

            #line default
            #line hidden
                this.Write(@", IAndroidView, IOptionsEventSource
    {
        private IViewLifecycleDelegate _lifecycleDelegate;

        public event EventHandler<OptionsItemSelectedEventArgs> OnOptionsItemSelectedCalled;

        protected IViewLifecycleDelegate LifecycleDelegate => _lifecycleDelegate ?? (_lifecycleDelegate = CreateLifecycleDelegate());

        protected virtual IViewLifecycleDelegate CreateLifecycleDelegate()
        {
            return new ViewLifecycleDelegate<");

            #line 48 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(">(this);\r\n        }\r\n\r\n        ");

            #line 51 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnCreate(Bundle savedInstanceState)\r\n        {\r\n            base.O" +
                           "nCreate(savedInstanceState);\r\n\r\n            LifecycleDelegate.OnCreate(savedInst" +
                           "anceState);\r\n        }\r\n\r\n        ");

            #line 58 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(@" override void OnStart()
        {
            base.OnStart();

            LifecycleDelegate.OnStart();
        }

        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            var optionsItemSelectedEventArgs = new OptionsItemSelectedEventArgs(item);
            OnOptionsItemSelectedCalled?.Invoke(this, optionsItemSelectedEventArgs);

            if (optionsItemSelectedEventArgs.Handled)
            {
                return true;
            }

            return base.OnOptionsItemSelected(item);
        }

        ");

            #line 78 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnActivityResult(int requestCode, ");

            #line 78 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ResultCodeTypeName));

            #line default
            #line hidden
                this.Write(" resultCode, Intent data)\r\n        {\r\n            LifecycleDelegate.OnActivityRes" +
                           "ult(requestCode, (Android.App.Result)resultCode, data);\r\n\r\n            base.OnAc" +
                           "tivityResult(requestCode, resultCode, data);\r\n        }\r\n\r\n        ");

            #line 85 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnSaveInstanceState(Bundle outState)\r\n        {\r\n            Lifec" +
                           "ycleDelegate.OnSaveInstanceState(outState);\r\n\r\n            base.OnSaveInstanceSt" +
                           "ate(outState);\r\n        }\r\n");

            #line 91 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                if (viewGenerationOptions.Kind == ViewKind.Fragment)
                {
            #line default
            #line hidden
                    this.Write("\r\n        public override void OnDestroyView()\r\n        {\r\n            LifecycleD" +
                               "elegate.OnDestroyView();\r\n\r\n            base.OnDestroyView();\r\n        }\r\n");

            #line 99 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                }

            #line default
            #line hidden
                this.Write("\r\n        ");

            #line 101 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.LifecycleMethodAccessModifier));

            #line default
            #line hidden
                this.Write(" override void OnDestroy()\r\n        {\r\n            LifecycleDelegate.OnDestroy();" +
                           "\r\n\r\n            base.OnDestroy();\r\n        }\r\n    }\r\n\r\n    public partial class " +
                           "");

            #line 109 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("<TViewModel> : ");

            #line 109 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(@", INavigationView<TViewModel>, IViewModelOwner<TViewModel>
        where TViewModel : class, IViewModelWithoutParameters, IStateOwner
    {
        private RequestCode _requestCode;

        public TViewModel ViewModel { get; private set; }

        public RequestCode RequestCode => _requestCode ?? (_requestCode = new RequestCode());

        protected override IViewLifecycleDelegate CreateLifecycleDelegate()
        {
            return new ViewLifecycleDelegate<");

            #line 120 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("<TViewModel>, TViewModel>(this);\r\n        }\r\n");

            #line 122 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                if (viewGenerationOptions.Kind == ViewKind.Fragment)
                {
            #line default
            #line hidden
                    this.Write(@"
        public void SetResult(Android.App.Result resultCode)
        {
            throw new NotSupportedException();
        }

        public void SetResult(Android.App.Result resultCode, Intent data)
        {
            throw new NotSupportedException();
        }

        public void Finish()
        {
            throw new NotImplementedException();
        }
");

            #line 138 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                }

            #line default
            #line hidden
                this.Write(@"
        void IViewModelOwner<TViewModel>.SetViewModel(TViewModel viewModel)
        {
            ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
        }

        async Task IViewModelOwner<TViewModel>.InitializeViewModelAsync()
        {
            await ViewModel.InitializeAsync();
        }
    }

    public partial class ");

            #line 151 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("<TViewModel, TParameters> : ");

            #line 151 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write(@", INavigationView<TViewModel>, IViewModelOwner<TViewModel>
        where TViewModel : class, IViewModelWithParameters<TParameters>, IStateOwner
        where TParameters : Parameters
    {
        private RequestCode _requestCode;

        public TViewModel ViewModel { get; private set; }

        public RequestCode RequestCode => _requestCode ?? (_requestCode = new RequestCode());

        protected override IViewLifecycleDelegate CreateLifecycleDelegate()
        {
            return new ViewLifecycleDelegate<");

            #line 163 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ClassName));

            #line default
            #line hidden
                this.Write("<TViewModel, TParameters>, TViewModel>(this);\r\n        }\r\n");

            #line 165 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                if (viewGenerationOptions.Kind == ViewKind.Fragment)
                {
            #line default
            #line hidden
                    this.Write(@"
        public void SetResult(Android.App.Result resultCode)
        {
            throw new NotSupportedException();
        }

        public void SetResult(Android.App.Result resultCode, Intent data)
        {
            throw new NotSupportedException();
        }

        public void Finish()
        {
            throw new NotImplementedException();
        }
");

            #line 181 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                }

            #line default
            #line hidden
                this.Write(@"
        void IViewModelOwner<TViewModel>.SetViewModel(TViewModel viewModel)
        {
            ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel));
        }

        async Task IViewModelOwner<TViewModel>.InitializeViewModelAsync()
        {
            await ViewModel.InitializeAsync(");

            #line 190 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
                this.Write(this.ToStringHelper.ToStringWithCulture(viewGenerationOptions.ParametersSourceName));

            #line default
            #line hidden
                this.Write("?.GetParameters<TParameters>());\r\n        }\r\n    }\r\n}\r\n");

            #line 194 "C:\FlexiMvvm\FlexiMvvm.Generation\Views\Generation\Android\ViewsGenerator.tt"
            }

            #line default
            #line hidden
            return(this.GenerationEnvironment.ToString());
        }