Coder Social home page Coder Social logo

winsdk_toast's People

Contributors

mo-dabao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

winsdk_toast's Issues

如果存在多个 action 按钮的情况下, 如何知道点击了哪个按钮?

image

如图所示, 点击了 1 2 3 4 过后 handle_activated 返回结果都是一样的

image

def testToast():
    # Step1. Create Notifier with applicationId
    notifier = Notifier('MQTT 消息通知')

    # Step2. Create Toast which contains the message to be shown
    toast = Toast()
    toast.add_text('第一行 1st line', hint_align='center', hint_style='caption')
    toast.add_text('第二行 2nd line')
    toast.add_text('第三行 3rd line', placement='attribution')
    # toast.add_image(path_pic, placement='appLogoOverride')

    # toast.add_input(type_='selection', id_='input_name')
    toast.add_action('1', hint_inputId='1')
    toast.add_action('2')
    toast.add_action('3')
    toast.add_action('4')

    toast.set_audio(silent='true')  # Mute

    # Step3. Show the Toast
    notifier.show(toast, handle_activated=notifyActiveHandler, handle_dismissed=handle_dismissed)


def notifyActiveHandler(event_args_activated: EventArgsActivated):
    print('activated')
    print('inputs:', event_args_activated.inputs)
    event_args_activated.sender
    print('argument:', event_args_activated.argument)


def handle_dismissed(event_args_dismissed: EventArgsDismissed):
    print('dismissed')
    print('reason:', event_args_dismissed.reason)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.