aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration/Templates/EnumerationFileJava.cshtml
blob: 43560820408ad2328f274278f5523b408ec1cebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.twine.tango.dal.enumerations;

import com.twine.tango.core.DescriptionAnnotation;

public enum @(Model.Name)
{
    @foreach (var prop in Model.Fields)
    {
        <div>
            @@DescriptionAnnotation(description = "@(prop.Description)")
            @(prop.Name)(@(prop.Value)),

        </div>
    }
    ;

    private int value;

    @(Model.Name)(int value)
    {
        this.value = value;
    }
}
itespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
using Tango.Scripting.IDE.Windows;
using Tango.SharedUI;

namespace Tango.Scripting.IDE.Notifications
{
    public class DefaultNotificationManager : INotificationManager
    {
        public Task<TViewModel> ShowDialog<TViewModel, TView>(TViewModel viewModel, TView view)
            where TViewModel : IDEDialogViewModel
            where TView : FrameworkElement
        {
            TaskCompletionSource<TViewModel> source = new TaskCompletionSource<TViewModel>();

            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                DialogWindow window = new DialogWindow();
                window.Title = viewModel.Title;
                window.Content = view;
                view.DataContext = viewModel;
                window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                window.Owner = Application.Current.MainWindow;
                viewModel.Accepted += () =>
                {
                    window.Close();
                    source.SetResult(viewModel);
                };
                viewModel.Canceled += () =>
                {
                    window.Close();
                    source.SetResult(viewModel);
                };
                window.ShowDialog();
            }));

            return source.Task;
        }

        public Task<TViewModel> ShowDialog<TViewModel>(TViewModel viewModel) where TViewModel : IDEDialogViewModel
        {
            var modelName = typeof(TViewModel).Name;
            var viewName = modelName.Replace("VM", "");
            var viewType = typeof(TViewModel).Assembly.GetType(typeof(TViewModel).Namespace + "." + viewName);
            var view = Activator.CreateInstance(viewType) as FrameworkElement;
            return ShowDialog(viewModel, view);
        }

        public Task<TViewModel> ShowDialog<TViewModel>() where TViewModel : IDEDialogViewModel
        {
            return ShowDialog(Activator.CreateInstance<TViewModel>());
        }

        public Task ShowError(string title, string message)
        {
            throw new NotImplementedException();
        }

        public Task ShowInfo(string title, string message)
        {
            throw new NotImplementedException();
        }

        public ProgressNotificationHandler ShowProgress(string title, string message, bool canCancel = false)
        {
            throw new NotImplementedException();
        }

        public Task<bool> ShowQuestion(string title, string message)
        {
            throw new NotImplementedException();
        }

        public Task ShowSuccess(string title, string message)
        {
            throw new NotImplementedException();
        }

        public Task ShowWarning(string title, string message)
        {
            throw new NotImplementedException();
        }

        private Task ShowMessageBox(String title, String message, bool hasCancel, BitmapSource icon)
        {
            return null;
        }
    }
}