protected override void ValueChanged (object sender, NotifyEventArgs args) { object val = args.Value; if (val == null) return; FileEntry entry = (FileEntry) Control; entry.Filename = (string) val; }
public Task<Func<object, string>> OnWebViewScriptNotify(NotifyEventArgs args, IWebViewPage page) { string value = args.Value; dynamic obj = JsonHelper.Parse(value); string endpoint = obj.endpoint; dynamic state = obj.json; Task<Func<object, string>> request = requestHandlers[endpoint](value, endpoint, state, page); return request; }
protected virtual void OnServerNotify(NotifyEventArgs e) { EventHandler<NotifyEventArgs> handler = ServerNotify; if(handler != null) { ServerNotify(this, e); } }
private void webBrowser_ScriptNotify(object sender, NotifyEventArgs e) { if (e.Value == "chooseAddress") { var task = new AddressChooserTask(); task.Completed += task_Completed; task.Show(); } }
private void Browser_ScriptNotify(object sender, NotifyEventArgs e) { // if a page notifies that it should not be scrollable, disable // scrolling. if (e.Value == "noScroll") { _browserHelper.ScrollDisabled = true; } }
override public void OnGConf_Changed(object sender, NotifyEventArgs args) { if (noGconfLoad) { return; } LoadConfig(); System.Console.WriteLine("OnGConf_Changed"); OnDataChanged(sender, this); }
protected override void ValueChanged (object sender, NotifyEventArgs args) { object val = args.Value; if (val == null) return; ColorPicker picker = (ColorPicker) Control; Color color = ColorTranslator.FromHtml ((string) val); picker.SetI8 (color.R, color.G, color.B, color.A); }
private void Wb_ScriptNotify(object sender, NotifyEventArgs e) { HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument(); htmlDocument.LoadHtml(e.Value); if (htmlDocument.DocumentNode.FirstChild.Attributes["module"].Value == "insertvideo") { var oid = JsonObject.Parse(htmlDocument.DocumentNode.FirstChild.Attributes["data"].Value)["objectid"].GetString(); MainPage.MainFrame.Navigate(typeof(VideoViews), String.Format(RequestApis.GetObject, oid)); } }
private static void EventNotified(NotifyEventArgs e) { var command = GetWinApiCommand(e.ObservedWindow); if (command != null && command.CanExecute(e)) { command.Execute(e); } }
static void browser_ScriptNotify(object sender, NotifyEventArgs e) { var wb = sender as WebBrowser; if (wb == null) return; var json = (Dictionary<String, String>) JsonConvert.DeserializeObject(e.Value, typeof(Dictionary<String, String>)); if (json.ContainsKey("offset_Height")) wb.Height = Convert.ToInt32(Math.Abs(Convert.ToDouble(json["offset_Height"]))); }
void browser_ScriptNotify(object sender, NotifyEventArgs e) { if (e.Value.StartsWith("launchPhoneCall:")) { string phoneNumber = e.Value.Remove(0, 16); PhoneCallTask phoneCallTask = new PhoneCallTask(); phoneCallTask.PhoneNumber = phoneNumber; phoneCallTask.Show(); } }
/* * This method does the work of routing commands * NotifyEventArgs.Value contains a string passed from JS * If the command already exists in our map, we will just attempt to call the method(action) specified, and pass the args along * Otherwise, we create a new instance of the command, add it to the map, and call it ... * This method may also receive JS error messages caught by window.onerror, in any case where the commandStr does not appear to be a valid command * it is simply output to the debugger output, and the method returns. * **/ void CordovaBrowser_ScriptNotify(object sender, NotifyEventArgs e) { string commandStr = e.Value; string commandName = commandStr.Split('/').FirstOrDefault(); if (browserDecorators.ContainsKey(commandName)) { browserDecorators[commandName].HandleCommand(commandStr); return; } CordovaCommandCall commandCallParams = CordovaCommandCall.Parse(commandStr); if (commandCallParams == null) { // ERROR Debug.WriteLine("ScriptNotify :: " + commandStr); } else if (commandCallParams.Service == "CoreEvents") { switch (commandCallParams.Action.ToLower()) { case "overridebackbutton": string arg0 = JsonHelper.Deserialize <string[]>(commandCallParams.Args)[0]; this.OverrideBackButton = (arg0 != null && arg0.Length > 0 && arg0.ToLower() == "true"); break; case "__exitapp": Debug.WriteLine("Received exitApp command from javascript, app will now exit."); CordovaBrowser.InvokeScript("eval", new string[] { "cordova.fireDocumentEvent('pause');" }); CordovaBrowser.InvokeScript("eval", new string[] { "setTimeout(function(){ cordova.fireDocumentEvent('exit'); cordova.exec(null,null,'CoreEvents','__finalexit',[]); },0);" }); break; case "__finalexit": IsExiting = true; // hide the browser to prevent white flashes, since about:blank seems to always be white CordovaBrowser.Opacity = 0d; CordovaBrowser.Navigate(new Uri("about:blank", UriKind.Absolute)); break; } } else { if (configHandler.IsPluginAllowed(commandCallParams.Service)) { commandCallParams.Namespace = configHandler.GetNamespaceForCommand(commandCallParams.Service); nativeExecution.ProcessCommand(commandCallParams); } else { Debug.WriteLine("Error::Plugin not allowed in config.xml. " + commandCallParams.Service); } } }
private void WebView_ScriptNotifyAsync(object sender, NotifyEventArgs e) { var callBack = JsonHelper.FromJson <string>(e.Value); //Debug.WriteLine("Notify CallBack ----> : " + e.Value); SetScroolHeight(callBack); SetScroolTop(callBack); SetActionLink(callBack); SetPictureShow(callBack); }
private async void Web_ScriptNotify(object sender, NotifyEventArgs e) { try { var test = JsonConvert.DeserializeObject <ForumCommand>(e.Value); await ViewModel.HandleForumCommand(test); } catch (Exception ex) { } }
private void MyWebView_ScriptNotify(object sender, NotifyEventArgs e) { var items = e.Value.Split(','); MenuFlyout myFlyout = new MenuFlyout(); MenuFlyoutItem firstItem = new MenuFlyoutItem { Text = "Open new tab" }; myFlyout.Items.Add(firstItem); myFlyout.ShowAt(sender as UIElement, new Point(System.Convert.ToDouble(items[0]), System.Convert.ToDouble(items[1]))); }
/// <summary> /// Called when [run status changed handler]. /// </summary> /// <param name="profileSender">The profile sender.</param> /// <param name="e">The <see cref="Argon.Common.NotifyEventArgs"/> instance containing the event data.</param> public static void OnNotifyHandler(Object sender, NotifyEventArgs e) { if (!e.Error) { UseCaseLogger.ShowInfo(e.Description); } else { UseCaseLogger.ShowError(e.Description); } }
protected override void ValueChanged (object sender, NotifyEventArgs args) { object val = args.Value; SpinButton spin = (SpinButton) Control; is_int = val is int; if (is_int) spin.Value = (double) (int) val; else spin.Value = (double) val; }
private async void ScriptNotify(object sender, NotifyEventArgs e) { if (e.Value == "change") { OnCodeContentChanged(); NewWindowSetter(); } else { await new MessageDialog(e.Value).ShowAsync(); } }
public static void ConsoleNotify(object sender, NotifyEventArgs args) { if (args.IsError) { Console.Error.WriteLine(args.Message); } else { Console.WriteLine(args.Message); } }
private void CommentUserClik_Handler(Object sender, NotifyEventArgs e) { if (e.Value != null) { string[] args = e.Value.Split(new[] { "-" }, StringSplitOptions.None); if (args.Length == 2) { Frame.Navigate(typeof(UserHomePage), new object[] { args[0], args[1] }); } } }
public NotificationRecord(NotifyEventArgs notification) { ScriptHash = notification.ScriptHash; State = notification.State; EventName = notification.EventName; if (notification.ScriptContainer is IInventory inventory) { InventoryHash = inventory.Hash; InventoryType = inventory.InventoryType; } }
private async void TaobaoLogin_ScriptNotify(object sender, NotifyEventArgs e) { var t = System.Net.WebUtility.UrlDecode(e.Value); System.Diagnostics.Debug.WriteLine("ScriptNotify:" + t); if (t.IndexOf("\"st\"") >= 0) { await LoggedProcess(await LoginHelper.XiamiLogin( JObject.Parse(t).GetValue("st").Value <string>())); } }
private void AppLinkCrawlerBrowserOnScriptNotify(object sender, NotifyEventArgs notifyEventArgs) { if (AppLinkObtainedEvent != null) { var platformCollections = JsonConvert.DeserializeObject <List <PlatformProperty> >(notifyEventArgs.Value); var appLink = CreateAppLink(platformCollections); AppLinkObtainedEvent(appLink); } }
public static void decomp_NotifyNextCabinet(object sender, NotifyEventArgs e) { #if DO_OUTPUT Console.WriteLine("Next Cabinet\n" + " Name of next cabinet where file continued = {0}\n" + " Name of next disk where file continued = {1}\n" + " Cabinet path name = {2}\n", e.args.str1, e.args.str2, e.args.str3); #endif e.Result = 0; }
void Footer_Notify(object sender, NotifyEventArgs e) { this.m_Messages.Add(e.Message.ToString()); if (this.InvokeRequired) { this.Invoke(new MethodInvoker(() => { this.sbMessage.Text = this.m_Messages[this.m_Messages.Count - 1]; })); } else { this.sbMessage.Text = this.m_Messages[this.m_Messages.Count - 1]; } }
private void ScriptNotify(object sender, NotifyEventArgs e) { var notify = JsonConvert.DeserializeObject <NotifytModel>(e.Value); switch (notify.Type) { case "href": string words = notify.Value1; SeeAlso(words); break; } }
private void onMulticityScriptNotify(object sender, NotifyEventArgs args) { var item = Item as MulticityMarker; if (null == item) { mcBookingBrowser.LoadCompleted -= onMulticityLoadCompleted; return; } switch (args.Value) { case "timer": return; break; case "document.ready": /* mcBookingBrowser.Navigate( new Uri("https://www.multicity-carsharing.de/?mobile=false", UriKind.Absolute), null, "User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)\r\n"); */ checkAndPrefillMulticityLoginform(); return; break; case "logging-in": break; case "mc-login-incorrect": if (MessageBoxResult.OK == MessageBox.Show( Strings.BookingMulticityUsernamePasswordWrongDialog, Strings.UsernameOrPasswordWrong, MessageBoxButton.OKCancel)) { gotoMulticityCredentials(); } Deactivate(); break; case "mc-booking-successful": MessageBox.Show(Strings.MulticityBookingSucessfull); FlurryWP7SDK.Api.LogEvent("MulticityBookingSucessfull"); //Deactivate(); break; case "mc-loggedin": return; default: return; } mcBookingBrowser.LoadCompleted -= onMulticityLoadCompleted; mcBookingBrowser.ScriptNotify -= onMulticityScriptNotify; Deactivate(); return; item = (MulticityMarker)Item; //VisualStateManager.GoToState(this, "MCBookingBrowserOpenState", true); var bookUri = new Uri( "https://kunden.multicity-carsharing.de/kundenbuchung/process.php?proc=buchen&autopos_id=&auto_id=" + item.ID + "&station_id=&open_end=J&instant_access=J", UriKind.Absolute); mcBookingBrowser.Navigate(new Uri("https://kunden.multicity-carsharing.de/kundenbuchung/process.php?proc=buchen&autopos_id=&auto_id=" + item.ID + "&station_id=&open_end=J&instant_access=J", UriKind.Absolute)); }
//Here, all general messages go public virtual void ScriptNotify(object sender, NotifyEventArgs e) { string msg = e.Value; string[] msgParts = msg.Split('|'); string method = msgParts[0]; if (JavascriptParser.isMapReady(method)) { handleMapReady(); } }
// Callback for PropertyNotification NotifySignal private void OnPropertyNotificationNotify(IntPtr propertyNotification) { NotifyEventArgs e = new NotifyEventArgs(); e.PropertyNotification = GetPropertyNotificationFromPtr(propertyNotification); if (_propertyNotificationNotifyEventHandler != null) { //here we send all data to user event handlers _propertyNotificationNotifyEventHandler(this, e); } }
private void HTML_Script(object sender, NotifyEventArgs e) { //MessageBox.Show(e.Value); if (e.Value == "backstackon") { _backstack = true; } else { _backstack = false; } }
private async void WifiStatusRequest_NotificationReceived(object sender, NotifyEventArgs e) { if (MessageProtocolFactory.ReadRequestMessagePayload(e.Data) is WifiStatusRequest wifiStatusRequest) { Debug.WriteLine($"Received Wi-Fi config message protocol request: '{wifiStatusRequest.RequestType}'"); bluetoothLeHelper.NotificationReceived -= WifiStatusRequest_NotificationReceived; await SendResponseAsync(currentService, wifiStatusRequest, 0x00); WifiStatusRequestReceived?.Invoke(this, new WifiStatusRequestEventArgs(wifiStatusRequest)); } }
private void WebViewOnScriptNotify(object sender, NotifyEventArgs notifyEventArgs) { Action <string> action; var values = notifyEventArgs.Value.Split('/'); var name = values.FirstOrDefault(); if (name != null && this.Model.TryGetAction(name, out action)) { var data = Uri.UnescapeDataString(values.ElementAt(1)); action.Invoke(data); } }
protected override void ValueChanged(object sender, NotifyEventArgs args) { object val = args.Value; if (val == null) { return; } Entry entry = (Entry)Control; entry.Text = (string)val; }
private void midiDetected(object sender, NotifyEventArgs e) { String rawMidi = e.Value.ToString(); System.Diagnostics.Debug.WriteLine(rawMidi); strUri = baseUrl + "/" + rawMidi.Replace(@"../", ""); Thread downloadThread = new Thread(new ThreadStart(downloadMid)); downloadThread.Name = "SynthStreamerThread"; downloadThread.Start(); }
private async void WebView_ScriptNotify(object sender, NotifyEventArgs e) { string[] urlParts = e.Value.Split('?'); string docLocation = urlParts[0]; Uri docUri = new Uri("ms-appx:///" + docLocation); var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(docUri); var props = await file.GetBasicPropertiesAsync(); var fileSize = props.Size; string range = urlParts[1]; string[] rangeParts = range.Split('&'); string originalRangeStart = rangeParts[0]; ulong rangeStart; // if the range start is negative then read from the end of the file if (originalRangeStart.StartsWith("-")) { ulong rangeStartPositive = (ulong)Math.Abs(Convert.ToInt64(originalRangeStart)); rangeStart = fileSize - rangeStartPositive; } else { rangeStart = Convert.ToUInt64(originalRangeStart); } // if the end range is not specified then it goes to the end of the file ulong rangeEnd = (rangeParts[1].Length == 0) ? fileSize : Convert.ToUInt64(rangeParts[1]); var stream = await file.OpenReadAsync(); stream.Seek(rangeStart); // get the number of bytes to read uint count = (uint)(rangeEnd - rangeStart); var bytes = new byte[count]; using (var dataReader = new DataReader(stream)) { await dataReader.LoadAsync(count); dataReader.ReadBytes(bytes); } string successFunction = string.Format("setTimeout(function() {{ window.CoreControls.PartRetrievers.WinRTPartRetriever.partSuccess('{0}', '{1}'); }}, 0);", Convert.ToBase64String(bytes), originalRangeStart); MyWebView.InvokeScript("eval", new string[] { successFunction }); }
// Visibilidad "To top button private void Vista_ScriptNotify(object sender, NotifyEventArgs e) { var result = e.Value; if (result == "true") { ToTopButton.Visibility = Visibility.Collapsed; } else { ToTopButton.Visibility = Visibility.Visible; } }
void NewsBrowser_ScriptNotify(object sender, NotifyEventArgs e) { string input = e.Value.ToString(); if (input.Contains("ms-appx-web")) { input = input.Replace("ms-appx-web", "ms-appx"); } ImageSource source = new BitmapImage(new Uri(input, UriKind.RelativeOrAbsolute)); image.Source = source; imageGrid.Visibility = Visibility.Visible; }
public void Set(string key, object val) { prefs [key] = val; foreach (string nkey in events.Keys) { NotifyEventHandler handler = events [nkey] as NotifyEventHandler; if (handler != null && key.StartsWith(nkey)) { NotifyEventArgs args = new NotifyEventArgs(key, val); handler(this, args); } } }
private void browser_ScriptNotify(object sender, NotifyEventArgs e) { if (e.Value == "getMemoryUsage") { var response = new object[] { DeviceStatus.ApplicationCurrentMemoryUsage, DeviceStatus.ApplicationMemoryUsageLimit, DeviceStatus.ApplicationPeakMemoryUsage, DeviceStatus.DeviceTotalMemory }; browser.InvokeScript("getMemoryUsageCallback", response.Select(c => c.ToString()).ToArray()); } }
private void BrowserScriptNotify(object sender, NotifyEventArgs e) { var values = ParseQueryString(e.Value); if(values.ContainsKey("oauth_verifier")) { var verifier = values["oauth_verifier"]; _service.GetAccessToken(_requestToken, verifier, HandleAuthenticationAccessToken); } else { Dispatcher.BeginInvoke( () => MessageBox.Show("Did not authenticate correctly") ); } }
protected override void ValueChanged (object sender, NotifyEventArgs args) { object val = args.Value; int selected = ValueToInt (val); int i = group.Count - 1; foreach (RadioButton button in group) { if (i == selected) { button.Active = true; break; } i--; } }
private async void SignInWebBrowserControlScriptNotify(object sender, NotifyEventArgs e) { BrowserSignInControl.ScriptNotify -= SignInWebBrowserControlScriptNotify; try { var rswt = await RequestSecurityTokenResponse.FromJSONAsync(e.Value); _messageHub.Publish(rswt == null ? new RequestTokenMessage(this) {TokenResponse = null} : new RequestTokenMessage(this) {TokenResponse = rswt}); } catch(Exception) { _messageHub.Publish(new RequestTokenMessage(this) { TokenResponse = null }); } }
void WebViewControl_ScriptNotify(object sender, NotifyEventArgs e) { if (!string.IsNullOrEmpty(e.Value)) { if (e.Value.ToLower().StartsWith("alert:")) { string cmdParams = e.Value.Substring(e.Value.IndexOf(":") + 1); MessageBox.Show(cmdParams, "Alert", MessageBoxButton.OK); } else { JObject optionsJson = JObject.Parse(e.Value); if (optionsJson != null) { string plugin = ""; string action = ""; string args = ""; string callback = ""; JToken pluginJToken = null; pluginJToken = optionsJson["plugin"]; if (pluginJToken != null) plugin = (pluginJToken as JValue).Value.ToString(); JToken actionJToken = null; actionJToken = optionsJson["action"]; if (actionJToken != null) action = (actionJToken as JValue).Value.ToString(); JToken argsJToken = null; argsJToken = optionsJson["args"]; if (argsJToken != null) args = (argsJToken as JValue).Value.ToString(); JToken callbackJToken = null; callbackJToken = optionsJson["callback"]; if (callbackJToken != null) callback = (callbackJToken as JValue).Value.ToString(); PluginSDK.GOPluginManager.Execute(this, this.WebViewControl, plugin, action, args, callback); } } } }
internal void OnCopyFile(Object sender, NotifyEventArgs e) { // имя результирующего файла после распаковки String fileName = GetFileName(e); // и его каталог String directoryName = Path.GetDirectoryName(fileName); // проверяем существование каталога, в который надо распаковать файл if (Directory.Exists(directoryName)) Directory.CreateDirectory(directoryName); // создаем результирующий файл Int32 err = 0; IntPtr handle = CabIO.FileOpen(fileName, FileAccess.Write, FileShare.ReadWrite, FileMode.Create, ref err); // возвращаем хэндл файла e.Result = (Int32)handle; }
internal void OnCloseFile(Object sender, NotifyEventArgs e) { // файл распакован, закрываем его Int32 err = 0; CabIO.FileClose(e.args.FileHandle, ref err, null); // имя результирующего файла после распаковки String fileName = GetFileName(e); // устанавливаем дату и время для файла DateTime timestamp = FCntl.DateTimeFromDosDateTime(e.args.FileDate, e.args.FileTime); File.SetCreationTime(fileName, timestamp); File.SetLastWriteTime(fileName, timestamp); // устанавливаем атрибуты файла FileAttributes fa = FCntl.FileAttributesFromFAttrs(e.args.FileAttributes); File.SetAttributes(fileName, fa); // возвращаем результат e.Result = 1; }
void browser_ScriptNotify(object sender, NotifyEventArgs e) { TiRequest request = JsonConvert.DeserializeObject<TiRequest>(e.Value); TiResponse response; try { if (request.type == null) { throw new Exception("Request Exception: Missing request \"type\" param"); } if (!requestHandlers.ContainsKey(request.type)) { throw new Exception("Request Exception: Invalid request type \"" + request.type + "\""); } if (request.data == null) { throw new Exception("Request Exception: Missing request \"data\" param"); } response = requestHandlers[request.type].process(request.data); } catch (Exception ex) { response = new TiResponse(); response["error"] = ex.ToString(); } // if the handler doesn't have a response, then just return if (response == null) { return; } // if the request has a token, then add it to the response if (request.token != null) { response["token"] = request.token; } // pass the response back to the browser try { browser.InvokeScript("execScript", new string[] { "tiwp8.handleResponse(" + JsonConvert.SerializeObject(response, Formatting.None) + ")" }); } catch { } }
private static void worker_Notify(object sender, NotifyEventArgs e) { System.Console.WriteLine(e.Status.ToString() + " :" + e.Message); }
private void notifyMessage(NotifyEventArgs notifyEventArgs) { switch (notifyEventArgs.EventData) { case "Domain-Up": { if ( !isConnecting && serverInfo == null ) { isConnecting = true; try { DomainInformation domainInfo = simiasWebService.GetDomainInformation(notifyEventArgs.Message); Connecting connecting = new Connecting( this.ifWebService, simiasWebService, simiasManager, domainInfo ); connecting.StartPosition = FormStartPosition.CenterScreen; if ( connecting.ShowDialog() != DialogResult.OK ) { serverInfo = new ServerInfo(this.ifWebService, simiasManager, domainInfo, connecting.Password); serverInfo.Closed += new EventHandler(serverInfo_Closed); serverInfo.Show(); ShellNotifyIcon.SetForegroundWindow(serverInfo.Handle); } else { try { bool update = CheckForClientUpdate(domainInfo.ID); if (update) { ShutdownTrayApp(null); } } catch { } domainInfo.Authenticated = true; preferences.UpdateDomainStatus(new Domain(domainInfo)); globalProperties.AddDomainToUIList(domainInfo); globalProperties.updateifListViewDomainStatus(domainInfo.ID, true); } } catch (Exception ex) { MessageBox.Show(string.Format("Exception here: {0}--{1}", ex.Message, ex.StackTrace)); } isConnecting = false; } break; } } }
protected override void ValueChanged (object sender, NotifyEventArgs args) { object val = args.Value; OptionMenu menu = (OptionMenu) Control; menu.SetHistory ((uint) ValueToInt (val)); }
public static void decomp_NotifyCabinetInfo(object sender, NotifyEventArgs e) { #if DO_OUTPUT Console.WriteLine("Cabinet Info" + " Next cabinet = {0}\n" + " Next disk = {1}\n" + " Cabinet path = {2}\n" + " Cabinet set id = {3}\n" + " Cabinet # in set = {4}", e.args.str1, e.args.str2, e.args.CabinetPathName, e.args.SetId, e.args.CabinetNumber); #endif e.Result = 0; }
public void Set (string key, object val) { prefs [key] = val; foreach (string nkey in events.Keys) { NotifyEventHandler handler = events [nkey] as NotifyEventHandler; if (handler != null && key.StartsWith (nkey)) { NotifyEventArgs args = new NotifyEventArgs (key, val); handler (this, args); } } }
void OnPreferencesChanged(object sender, NotifyEventArgs args) { LoadPreference (args.Key); }
public static void decomp_NotifyPartialFile(object sender, NotifyEventArgs e) { Console.WriteLine("Partial File\n" + " Name of continued file = {0}\n" + " Name of cabinet where file starts = {1}\n" + " Name of disk where file starts = {2}", e.args.str1, e.args.str2, e.args.CabinetPathName); e.Result = 0; }
public static void decomp_NotifyEnumerate(object sender, NotifyEventArgs e) { }
public static void decomp_NotifyCloseFile(object sender, NotifyEventArgs e) { #if DO_OUTPUT Console.WriteLine("Close File Info\n" + " File name in cabinet = {0}", e.args.str1); #endif string fname = destinationDirectory + e.args.str1; // TODO: Most of this function probably should be encapsulated in the parent object. int err = 0; CabIO.FileClose(e.args.FileHandle, ref err, null); // set file date and time DateTime fileDateTime = FCntl.DateTimeFromDosDateTime(e.args.FileDate, e.args.FileTime); File.SetCreationTime(fname, fileDateTime); File.SetLastWriteTime(fname, fileDateTime); // get relevant file attributes and set attributes on the file FileAttributes fa = FCntl.FileAttributesFromFAttrs(e.args.FileAttributes); File.SetAttributes(fname, fa); e.Result = 1; }
public static void decomp_NotifyCopyFile(object sender, NotifyEventArgs e) { string response = "Y"; #if DO_OUTPUT Console.Write("Copy File\n" + " File name in cabinet = {0}\n" + " Uncompressed file size = {1}\n" + " Copy this file? (y/n): ", e.args.str1, e.args.Size); do { response = Console.ReadLine().ToUpper(); } while (response != "Y" && response != "N"); #endif if (response == "Y") { int err = 0; string destFilename = destinationDirectory + e.args.str1; #if DO_OUTPUT Console.WriteLine(destFilename); #endif IntPtr fHandle = CabIO.FileOpen(destFilename, FileAccess.Write, FileShare.ReadWrite, FileMode.Create, ref err); e.Result = (int)fHandle; } else { e.Result = 0; } }
// ScriptCallback private void ScriptCallback(object sender, NotifyEventArgs e) { if(e.Value.Length < 8) { Debug.WriteLine(LOG_TAG + ": ScriptNotify: " + e.Value); return; } switch( e.Value.Substring(0,8) ) { case "onLoad::": pageLoaded(); break; case "onOpen::": channelOpen(); break; case "onClose:": channelClosed(); break; case "errors::": channelError(e.Value.Substring(8)); break; case "message:": channelMessageReceived(e.Value.Substring(8)); break; default: Debug.WriteLine(LOG_TAG + ": ScriptNotify: " + e.Value); break; } }
protected abstract void ValueChanged (object sender, NotifyEventArgs args);