aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/StringToBoolYesNoNullConverter.cs
blob: f7633a7d0e948d3cda93fa7f5bc9f2075b758a38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;

namespace Tango.MachineStudio.Statistics.Converters
{
    public class StringToBoolYesNoNullConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value is bool)
            {
                return (bool)value ? "Yes" : "No";
            }
            return "Null";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            //throw new NotImplementedException();
            if (value is ComboBoxItem)
            {
                string str_val = ((ComboBoxItem)value).Content.ToString();
                if (str_val.ToUpper() == "NO")
                    return false;
                if (str_val.ToUpper() == "YES")
                    return true;
            }
            return null;
        }
    }
}
#error regenerate this file with a newer version of protoc. #endif #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/arena.h> #include <google/protobuf/arenastring.h> #include <google/protobuf/generated_message_table_driven.h> #include <google/protobuf/generated_message_util.h> #include <google/protobuf/metadata.h> #include <google/protobuf/message.h> #include <google/protobuf/repeated_field.h> // IWYU pragma: export #include <google/protobuf/extension_set.h> // IWYU pragma: export #include <google/protobuf/unknown_field_set.h> // @@protoc_insertion_point(includes) namespace Tango { namespace PMR { namespace Stubs { class StubOptLimitSwitchRequest; class StubOptLimitSwitchRequestDefaultTypeInternal; extern StubOptLimitSwitchRequestDefaultTypeInternal _StubOptLimitSwitchRequest_default_instance_; } // namespace Stubs } // namespace PMR } // namespace Tango namespace Tango { namespace PMR { namespace Stubs { namespace protobuf_StubOptLimitSwitchRequest_2eproto { // Internal implementation detail -- do not call these. struct TableStruct { static const ::google::protobuf::internal::ParseTableField entries[]; static const ::google::protobuf::internal::AuxillaryParseTableField aux[]; static const ::google::protobuf::internal::ParseTable schema[]; static const ::google::protobuf::uint32 offsets[]; static const ::google::protobuf::internal::FieldMetadata field_metadata[]; static const ::google::protobuf::internal::SerializationTable serialization_table[]; static void InitDefaultsImpl(); }; void AddDescriptors(); void InitDefaults(); } // namespace protobuf_StubOptLimitSwitchRequest_2eproto // =================================================================== class StubOptLimitSwitchRequest : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:Tango.PMR.Stubs.StubOptLimitSwitchRequest) */ { public: StubOptLimitSwitchRequest(); virtual ~StubOptLimitSwitchRequest(); StubOptLimitSwitchRequest(const StubOptLimitSwitchRequest& from); inline StubOptLimitSwitchRequest& operator=(const StubOptLimitSwitchRequest& from) { CopyFrom(from); return *this; } #if LANG_CXX11 StubOptLimitSwitchRequest(StubOptLimitSwitchRequest&& from) noexcept : StubOptLimitSwitchRequest() { *this = ::std::move(from); } inline StubOptLimitSwitchRequest& operator=(StubOptLimitSwitchRequest&& from) noexcept { if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) { if (this != &from) InternalSwap(&from); } else { CopyFrom(from); } return *this; } #endif static const ::google::protobuf::Descriptor* descriptor(); static const StubOptLimitSwitchRequest& default_instance(); static inline const StubOptLimitSwitchRequest* internal_default_instance() { return reinterpret_cast<const StubOptLimitSwitchRequest*>( &_StubOptLimitSwitchRequest_default_instance_); } static PROTOBUF_CONSTEXPR int const kIndexInFileMessages = 0; void Swap(StubOptLimitSwitchRequest* other); friend void swap(StubOptLimitSwitchRequest& a, StubOptLimitSwitchRequest& b) { a.Swap(&b); } // implements Message ---------------------------------------------- inline StubOptLimitSwitchRequest* New() const PROTOBUF_FINAL { return New(NULL); } StubOptLimitSwitchRequest* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL; void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL; void CopyFrom(const StubOptLimitSwitchRequest& from); void MergeFrom(const StubOptLimitSwitchRequest& from); void Clear() PROTOBUF_FINAL; bool IsInitialized() const PROTOBUF_FINAL; size_t ByteSizeLong() const PROTOBUF_FINAL; bool MergePartialFromCodedStream( ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL; void SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL; ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray( bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL; int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; } private: void SharedCtor(); void SharedDtor(); void SetCachedSize(int size) const PROTOBUF_FINAL; void InternalSwap(StubOptLimitSwitchRequest* other); private: inline ::google::protobuf::Arena* GetArenaNoVirtual() const { return NULL; } inline void* MaybeArenaPtr() const { return NULL; } public: ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL; // nested types ---------------------------------------------------- // accessors ------------------------------------------------------- // uint32 LimitSwitchrId = 1; void clear_limitswitchrid(); static const int kLimitSwitchrIdFieldNumber = 1; ::google::protobuf::uint32 limitswitchrid() const; void set_limitswitchrid(::google::protobuf::uint32 value); // bool LimitSwitchrDisable = 2; void clear_limitswitchrdisable(); static const int kLimitSwitchrDisableFieldNumber = 2; bool limitswitchrdisable() const; void set_limitswitchrdisable(bool value); // @@protoc_insertion_point(class_scope:Tango.PMR.Stubs.StubOptLimitSwitchRequest) private: ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::uint32 limitswitchrid_; bool limitswitchrdisable_; mutable int _cached_size_; friend struct protobuf_StubOptLimitSwitchRequest_2eproto::TableStruct; }; // =================================================================== // =================================================================== #if !PROTOBUF_INLINE_NOT_IN_HEADERS #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" #endif // __GNUC__ // StubOptLimitSwitchRequest // uint32 LimitSwitchrId = 1; inline void StubOptLimitSwitchRequest::clear_limitswitchrid() { limitswitchrid_ = 0u; } inline ::google::protobuf::uint32 StubOptLimitSwitchRequest::limitswitchrid() const { // @@protoc_insertion_point(field_get:Tango.PMR.Stubs.StubOptLimitSwitchRequest.LimitSwitchrId) return limitswitchrid_; } inline void StubOptLimitSwitchRequest::set_limitswitchrid(::google::protobuf::uint32 value) { limitswitchrid_ = value; // @@protoc_insertion_point(field_set:Tango.PMR.Stubs.StubOptLimitSwitchRequest.LimitSwitchrId) } // bool LimitSwitchrDisable = 2; inline void StubOptLimitSwitchRequest::clear_limitswitchrdisable() { limitswitchrdisable_ = false; } inline bool StubOptLimitSwitchRequest::limitswitchrdisable() const { // @@protoc_insertion_point(field_get:Tango.PMR.Stubs.StubOptLimitSwitchRequest.LimitSwitchrDisable) return limitswitchrdisable_; } inline void StubOptLimitSwitchRequest::set_limitswitchrdisable(bool value) { limitswitchrdisable_ = value; // @@protoc_insertion_point(field_set:Tango.PMR.Stubs.StubOptLimitSwitchRequest.LimitSwitchrDisable) } #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ #endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // @@protoc_insertion_point(namespace_scope) } // namespace Stubs } // namespace PMR } // namespace Tango // @@protoc_insertion_point(global_scope) #endif // PROTOBUF_StubOptLimitSwitchRequest_2eproto__INCLUDED